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'; | |
d1888640 | 7 | import { JsonType } from '../types/JsonType'; |
14763b46 | 8 | |
e7accadb | 9 | export default class OCPPError extends BaseError { |
14763b46 | 10 | code: ErrorType | IncomingRequestCommand; |
a6b3c6c3 | 11 | command?: RequestCommand | IncomingRequestCommand; |
d1888640 | 12 | details?: JsonType; |
14763b46 | 13 | |
e7aeea18 JB |
14 | constructor( |
15 | code: ErrorType | IncomingRequestCommand, | |
16 | message: string, | |
17 | command?: RequestCommand | IncomingRequestCommand, | |
18 | details?: JsonType | |
19 | ) { | |
14763b46 JB |
20 | super(message); |
21 | ||
14763b46 | 22 | this.code = code ?? ErrorType.GENERIC_ERROR; |
9292e32a | 23 | this.command = command; |
14763b46 | 24 | this.details = details ?? {}; |
14763b46 JB |
25 | } |
26 | } |