X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fexception%2FOCPPError.ts;h=54b80fb67d320d89a4aadaf9d365a5ab2810acd6;hb=d5f64697c0471d8f8873f97163fd15b2a2ceabf0;hp=35df1f5083643929e5c35bc309ed33be82335d93;hpb=bfa591a39d837023fb3acfc5083d3d648419f130;p=e-mobility-charging-stations-simulator.git diff --git a/src/exception/OCPPError.ts b/src/exception/OCPPError.ts index 35df1f50..54b80fb6 100644 --- a/src/exception/OCPPError.ts +++ b/src/exception/OCPPError.ts @@ -1,29 +1,29 @@ -// Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved. +// Partial Copyright Jerome Benoit. 2021-2024. All Rights Reserved. -import { BaseError } from './BaseError'; +import { BaseError } from './BaseError.js' import { - ErrorType, + type ErrorType, type IncomingRequestCommand, type JsonType, - type RequestCommand, -} from '../types'; -import { Constants } from '../utils'; + type RequestCommand +} from '../types/index.js' +import { Constants } from '../utils/index.js' export class OCPPError extends BaseError { - code: ErrorType; - command?: RequestCommand | IncomingRequestCommand; - details?: JsonType; + code: ErrorType + command?: RequestCommand | IncomingRequestCommand + details?: JsonType - constructor( + constructor ( code: ErrorType, message: string, command?: RequestCommand | IncomingRequestCommand, details?: JsonType ) { - super(message); + super(message) - this.code = code ?? ErrorType.GENERIC_ERROR; - this.command = command; - this.details = details ?? Constants.EMPTY_FREEZED_OBJECT; + this.code = code + this.command = command ?? (Constants.UNKNOWN_COMMAND as RequestCommand | IncomingRequestCommand) + this.details = details } }