X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FOcppError.ts;h=6780b60bcc032bc8f3470069b0150836c4d42dcf;hb=147d0e0f63942b395dabf86ab7488f6f270cf027;hp=1f384783a90e428c12bdb48ea7b05f8189ab4373;hpb=a4a217091f3e2b774e3b5e5c835f59f80684fcff;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/OcppError.ts b/src/charging-station/OcppError.ts index 1f384783..6780b60b 100644 --- a/src/charging-station/OcppError.ts +++ b/src/charging-station/OcppError.ts @@ -1,15 +1,15 @@ -import Constants from '../utils/Constants'; +import { ErrorType } from '../types/ocpp/ErrorType'; export default class OCPPError extends Error { code: string; - details; + details?: any; - constructor(code: string, message:string , details?) { + constructor(code: string, message: string, details?: any) { super(message); - this.code = code || Constants.OCPP_ERROR_GENERIC_ERROR; - this.message = message || ''; - this.details = details || {}; + this.code = code ?? ErrorType.GENERIC_ERROR; + this.message = message ?? ''; + this.details = details ?? {}; Object.setPrototypeOf(this, OCPPError.prototype); // For instanceof