import { BaseErrorHandler } from './base-error.handler'; import { BackendResponseModel } from '../../models'; export class ExceptionHandler extends BaseErrorHandler { handle(): BackendResponseModel { const error = this.httpResponseError?.errors[0]; const result = new BackendResponseModel(); if (error) { result.addError(error.errorCode, error.message); } return result; } canHandle(): boolean { return ( !!this.httpResponseError?.isException && !!this.httpResponseError.errors[0] ); } }