import { ErrorWithHttpStatusCode } from '@squiz/dx-common-lib'; export class JobError extends ErrorWithHttpStatusCode { name = 'JobError'; constructor( public requestId: string, public error: Error | any, public functionName: string, public jobName: string, public jobVersion: string, statusCode: number = 500, ) { let message = 'An error occurred with no additional information available'; if (typeof error === 'string' && error) { message = error; } else if (error?.message) { message = error.message; } super(statusCode, message); this.stack = error?.stack; } }