Add tunable for phase line to line voltage MeterValues
[e-mobility-charging-stations-simulator.git] / src / charging-station / OcppError.ts
index 3de71eb539125bc22de51da613948a7ea6b8e444..6780b60bcc032bc8f3470069b0150836c4d42dcf 100644 (file)
@@ -1,15 +1,15 @@
-import Constants from '../utils/Constants';
+import { ErrorType } from '../types/ocpp/ErrorType';
 
 export default class OCPPError extends Error {
   code: string;
-  details: any;
+  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