X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPError.ts;h=cdb75027986bf1413b0571bc5d908f4bed0217b5;hb=331e20bbca5a7f404551666c4a3609ae92fc5e86;hp=cd449b10f8cbfc93838bb9b617c053a6a9108b4b;hpb=b4d3425171fa4e08c00e84f129b0c1edd2fb9585;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPError.ts b/src/charging-station/ocpp/OCPPError.ts index cd449b10..cdb75027 100644 --- a/src/charging-station/ocpp/OCPPError.ts +++ b/src/charging-station/ocpp/OCPPError.ts @@ -2,9 +2,10 @@ import { IncomingRequestCommand, RequestCommand } from '../../types/ocpp/Requests'; +import BaseError from '../../exception/BaseError'; import { ErrorType } from '../../types/ocpp/ErrorType'; -export default class OCPPError extends Error { +export default class OCPPError extends BaseError { code: ErrorType | IncomingRequestCommand; command?: RequestCommand | IncomingRequestCommand; details?: Record; @@ -12,14 +13,8 @@ export default class OCPPError extends Error { constructor(code: ErrorType | IncomingRequestCommand, message: string, command?: RequestCommand | IncomingRequestCommand, details?: Record) { super(message); - this.name = new.target.name; this.code = code ?? ErrorType.GENERIC_ERROR; - this.message = message ?? ''; this.command = command; this.details = details ?? {}; - - Object.setPrototypeOf(this, new.target.prototype); - - Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : (this.stack = (new Error()).stack); } }