@@ -24,12 +24,11 @@ import {
2424 type Env ,
2525} from "./environment" ;
2626import { ConfigurationError } from "./errors" ;
27- import * as json from "./json" ;
2827import { Language } from "./languages" ;
2928import { Logger } from "./logging" ;
3029
3130// Re-export for backwards compatibility to avoid updating a lot of imports elsewhere.
32- export { ConfigurationError } from "./errors" ;
31+ export { ConfigurationError , HTTPError , asHTTPError } from "./errors" ;
3332export {
3433 getRequiredEnvParam ,
3534 getOptionalEnvVar ,
@@ -566,29 +565,6 @@ export function initializeEnvironment(version: string, env: Env = getEnv()) {
566565 env . export ( EnvVar . VERSION , version ) ;
567566}
568567
569- export class HTTPError extends Error {
570- public status : number ;
571-
572- constructor ( message : string , status : number ) {
573- super ( message ) ;
574- this . status = status ;
575- }
576- }
577-
578- export function asHTTPError ( arg : any ) : HTTPError | undefined {
579- if ( ! json . isObject < any > ( arg ) || ! json . isString ( arg . message ) ) {
580- return undefined ;
581- }
582- if ( Number . isInteger ( arg . status ) ) {
583- return new HTTPError ( arg . message , arg . status as number ) ;
584- }
585- // See https://github.com/actions/toolkit/blob/acb230b99a46ed33a3f04a758cd68b47b9a82908/packages/tool-cache/src/tool-cache.ts#L19
586- if ( Number . isInteger ( arg . httpStatusCode ) ) {
587- return new HTTPError ( arg . message , arg . httpStatusCode as number ) ;
588- }
589- return undefined ;
590- }
591-
592568export async function codeQlVersionAtLeast (
593569 codeql : CodeQL ,
594570 requiredVersion : string ,
0 commit comments