import { ErrorCodes } from './enums/error-codes.enum'; export class RawErrorItem { errorCode: ErrorCodes; message: any; details: any; constructor(errorCode: ErrorCodes, message?: string) { this.errorCode = errorCode; this.message = message; } } export class RawHttpErrorResponse { errors: RawErrorItem[] = []; isException: boolean; get status(): number { return this.localStatus; } get rawData(): any { return this.localRawData; } get url(): string { return this.localUrl; } private localRawData: any; private localStatus: number; private localUrl: string; constructor(rawData: any) { this.localRawData = rawData; this.localStatus = (rawData && rawData.status) || null; this.localUrl = (rawData && rawData.url) || null; this.isException = false; } setError(errorCode: ErrorCodes, message?: string): RawErrorItem { const rawError = new RawErrorItem(errorCode, message); this.errors.push(rawError); return rawError; } }