UNPKG

soccer-go

Version:

Soccer CLI for stats and results.

36 lines (35 loc) 1.5 kB
/// <reference types="node" /> /** * 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, COMMAND_UNKNOWN = 1001, API_KEY_MISSING = 1002, API_KEY_INVALID = 1003, API_RESPONSE_400 = 1004, API_RESPONSE_429 = 1005, API_RESPONSE_500 = 1006, LEAGUE_NOT_FOUND_BY_NAME = 1007, LEAGUE_NOT_FOUND_BY_CODE = 1008, TEAM_NOT_FOUND = 1009, NETWORK_UNREACHABLE = 1010 } export declare class ApplicationError extends Error { code: ErrorCode; extraData?: string | undefined; constructor(code: ErrorCode.GENERIC, message: string); constructor(code: ErrorCode.COMMAND_UNKNOWN, command: 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;