import { ErrorType , ErrorValidation , ErrorResponse } from './types' ; export class CustomError extends Error { private httpStatusCode : number ; private errorType : ErrorType ; private errors : string [ ] | null ; private errorRaw : any ; private errorsValidation : ErrorValidation [ ] | null ; constructor ( httpStatusCode , errorType , message , errors = null , errorRaw = null , errorsValidation = null ) { super ( message ) ; this . name = this . constructor . name ; this . httpStatusCode = httpStatusCode ; this . errorType = errorType ; this . errors = errors ; this . errorRaw = errorRaw ; this . errorsValidation = errorsValidation ; } get HttpStatusCode ( ) { return this . httpStatusCode ; } get JSON ( ) : ErrorResponse { return { errorType : this . errorType , errorMessage : this . message , errors : this . errors , errorRaw : this . errorRaw , errorsValidation : this . errorsValidation , stack : this . stack , } ; } }