Commit | Line | Data |
---|---|---|
b4d34251 JB |
1 | // Partial Copyright Jerome Benoit. 2021. All Rights Reserved. |
2 | ||
e58068fd | 3 | import { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests'; |
a6b3c6c3 | 4 | |
e58068fd JB |
5 | import BaseError from './BaseError'; |
6 | import { ErrorType } from '../types/ocpp/ErrorType'; | |
14763b46 | 7 | |
e7accadb | 8 | export default class OCPPError extends BaseError { |
14763b46 | 9 | code: ErrorType | IncomingRequestCommand; |
a6b3c6c3 | 10 | command?: RequestCommand | IncomingRequestCommand; |
ae8ee665 | 11 | details?: Record<string, unknown>; |
14763b46 | 12 | |
ae8ee665 | 13 | constructor(code: ErrorType | IncomingRequestCommand, message: string, command?: RequestCommand | IncomingRequestCommand, details?: Record<string, unknown>) { |
14763b46 JB |
14 | super(message); |
15 | ||
14763b46 | 16 | this.code = code ?? ErrorType.GENERIC_ERROR; |
9292e32a | 17 | this.command = command; |
14763b46 | 18 | this.details = details ?? {}; |
14763b46 JB |
19 | } |
20 | } |