Spaces:
Sleeping
Sleeping
File size: 382 Bytes
c536472 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | export class HttpError extends Error {
readonly status: number;
readonly code: string;
constructor(status: number, code: string, message: string) {
super(message);
this.status = status;
this.code = code;
}
}
export function getErrorMessage(error: unknown): string {
if (error instanceof Error) {
return error.message;
}
return "Unexpected error";
}
|