soccer-go
Version:
Soccer CLI for stats and results.
33 lines (32 loc) • 1.38 kB
TypeScript
/**
* Asserts if a alleged `error` is a Node.js system error.
*/
export declare const isErrorNodeSystemError: (error: unknown) => error is NodeJS.ErrnoException;
export declare enum ErrorCode {
GENERIC = 1000,
API_KEY_MISSING = 1001,
API_KEY_INVALID = 1002,
API_RESPONSE_400 = 1003,
API_RESPONSE_429 = 1004,
API_RESPONSE_500 = 1005,
LEAGUE_NOT_FOUND_BY_NAME = 1006,
LEAGUE_NOT_FOUND_BY_CODE = 1007,
TEAM_NOT_FOUND = 1008,
NETWORK_UNREACHABLE = 1009
}
export declare class ApplicationError extends Error {
code: ErrorCode;
extraData?: string | undefined;
constructor(code: ErrorCode.GENERIC, message: string);
constructor(code: ErrorCode.API_KEY_MISSING);
constructor(code: ErrorCode.API_KEY_INVALID);
constructor(code: ErrorCode.API_RESPONSE_400, message: string);
constructor(code: ErrorCode.API_RESPONSE_429);
constructor(code: ErrorCode.API_RESPONSE_500);
constructor(code: ErrorCode.TEAM_NOT_FOUND, teamName: string);
constructor(code: ErrorCode.LEAGUE_NOT_FOUND_BY_NAME, leagueName: string);
constructor(code: ErrorCode.LEAGUE_NOT_FOUND_BY_CODE, leagueCode: string);
constructor(code: ErrorCode.NETWORK_UNREACHABLE);
}
export declare const formatErrorForPrinting: (code: ErrorCode, extraData?: string) => string;
export declare const handleCommandError: (error: unknown) => void;