Commit | Line | Data |
---|---|---|
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 | } |