2bef07d4f2770b91e047738fe3ed48e45e5f5c07
[e-mobility-charging-stations-simulator.git] / src / charging-station / OcppError.js
1 import Constants from '../utils/Constants.js';
2
3 export default class OCPPError extends Error {
4 constructor(code, message, details) {
5 super(message);
6
7 this.code = code || Constants.OCPP_ERROR_GENERIC_ERROR;
8 this.message = message || '';
9 this.details = details || {};
10
11 Object.setPrototypeOf(this, OCPPError.prototype); // for instanceof
12
13 Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : (this.stack = (new Error()).stack);
14 }
15 }