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"; }