X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPError.ts;h=cd449b10f8cbfc93838bb9b617c053a6a9108b4b;hb=d09085e9e6ec32bb1873b8f4cc1b326f7996d0f3;hp=b977062a0957d568180ba9225bfb4fa3f49fcc02;hpb=14763b466177d8e74d2e1925647e04e2d62ac72a;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPError.ts b/src/charging-station/ocpp/OCPPError.ts index b977062a..cd449b10 100644 --- a/src/charging-station/ocpp/OCPPError.ts +++ b/src/charging-station/ocpp/OCPPError.ts @@ -1,16 +1,21 @@ +// Partial Copyright Jerome Benoit. 2021. All Rights Reserved. + +import { IncomingRequestCommand, RequestCommand } from '../../types/ocpp/Requests'; + import { ErrorType } from '../../types/ocpp/ErrorType'; -import { IncomingRequestCommand } from '../../types/ocpp/Requests'; export default class OCPPError extends Error { code: ErrorType | IncomingRequestCommand; - details?: unknown; + command?: RequestCommand | IncomingRequestCommand; + details?: Record; - constructor(code: ErrorType | IncomingRequestCommand, message: string, details?: unknown) { + 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);