X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fexception%2FOCPPError.ts;h=0c69eb23e31e957cbb2c5458a216867b49f5f9be;hb=0d1f33bab47bbcd712ea6ae7e26293917c8bc398;hp=e3c127fd22e375921f3303e0f70f2285ea7d6451;hpb=edd134392e237a3242dc2093341df70244c51472;p=e-mobility-charging-stations-simulator.git diff --git a/src/exception/OCPPError.ts b/src/exception/OCPPError.ts index e3c127fd..0c69eb23 100644 --- a/src/exception/OCPPError.ts +++ b/src/exception/OCPPError.ts @@ -1,11 +1,15 @@ // Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved. -import type { JsonType } from '../types/JsonType'; -import { ErrorType } from '../types/ocpp/ErrorType'; -import type { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests'; -import BaseError from './BaseError'; +import { BaseError } from './BaseError'; +import { + ErrorType, + type IncomingRequestCommand, + type JsonType, + type RequestCommand, +} from '../types'; +import { Constants } from '../utils'; -export default class OCPPError extends BaseError { +export class OCPPError extends BaseError { code: ErrorType; command?: RequestCommand | IncomingRequestCommand; details?: JsonType; @@ -14,12 +18,12 @@ export default class OCPPError extends BaseError { code: ErrorType, message: string, command?: RequestCommand | IncomingRequestCommand, - details?: JsonType + details?: JsonType, ) { super(message); this.code = code ?? ErrorType.GENERIC_ERROR; this.command = command; - this.details = details ?? {}; + this.details = details ?? Constants.EMPTY_FREEZED_OBJECT; } }