Initial portage to TypeScript.
[e-mobility-charging-stations-simulator.git] / src / charging-station / OcppError.ts
similarity index 66%
rename from src/charging-station/OcppError.js
rename to src/charging-station/OcppError.ts
index 2bef07d4f2770b91e047738fe3ed48e45e5f5c07..a43c62d30fc07791fe6195bd0d76942b3ce74d19 100644 (file)
@@ -1,14 +1,17 @@
-import Constants from '../utils/Constants.js';
+import Constants from '../utils/Constants';
 
 export default class OCPPError extends Error {
-  constructor(code, message, details) {
+  code;
+  details;
+
+  constructor(code, message, details?) {
     super(message);
 
     this.code = code || Constants.OCPP_ERROR_GENERIC_ERROR;
     this.message = message || '';
     this.details = details || {};
 
-    Object.setPrototypeOf(this, OCPPError.prototype); // for instanceof
+    Object.setPrototypeOf(this, OCPPError.prototype); // For instanceof
 
     Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : (this.stack = (new Error()).stack);
   }