Commit | Line | Data |
---|---|---|
a19b897d | 1 | // Partial Copyright Jerome Benoit. 2021-2024. All Rights Reserved. |
b4d34251 | 2 | |
fba0276c | 3 | import type { ErrorType, IncomingRequestCommand, JsonType, RequestCommand } from '../types/index.js' |
66a7748d | 4 | import { Constants } from '../utils/index.js' |
4c3f6c20 | 5 | import { BaseError } from './BaseError.js' |
14763b46 | 6 | |
268a74bb | 7 | export class OCPPError extends BaseError { |
66a7748d | 8 | code: ErrorType |
fba0276c | 9 | command: RequestCommand | IncomingRequestCommand |
66a7748d | 10 | details?: JsonType |
14763b46 | 11 | |
66a7748d | 12 | constructor ( |
b3ec7bc1 | 13 | code: ErrorType, |
e7aeea18 JB |
14 | message: string, |
15 | command?: RequestCommand | IncomingRequestCommand, | |
66a7748d | 16 | details?: JsonType |
e7aeea18 | 17 | ) { |
66a7748d | 18 | super(message) |
14763b46 | 19 | |
66a7748d | 20 | this.code = code |
1feac591 | 21 | this.command = command ?? Constants.UNKNOWN_OCPP_COMMAND |
66a7748d | 22 | this.details = details |
14763b46 JB |
23 | } |
24 | } |