import { AxiosError } from 'axios' ; import { LogLevel } from '../service/logger' ; import { cleanError } from '../utils/error' ; export interface ErrorLike { name ? : string ; message : string ; stack ? : string ; [ key ] : any ; } class extends Error export class ResolverError extends Error { public name = 'ResolverError' ; public level = LogLevel . Error ; param { ( string | AxiosError | ErrorLike ) } messageOrError param { number } status param { string } code constructor ( messageOrError , public status = 500 , public code = 'RESOLVER_ERROR' ) { super ( typeof messageOrError === 'string' ? messageOrError : messageOrError . message ) ; if ( typeof messageOrError === 'object' ) { Object . assign ( this , cleanError ( messageOrError ) ) ; } if ( typeof messageOrError === 'string' || ! messageOrError . stack ) { Error . captureStackTrace ( this , ResolverError ) ; } } }