docs: improve configuration file documentation
[e-mobility-charging-stations-simulator.git] / src / exception / OCPPError.ts
... / ...
CommitLineData
1// Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved.
2
3import { BaseError } from './BaseError.js'
4import {
5 type ErrorType,
6 type IncomingRequestCommand,
7 type JsonType,
8 type RequestCommand
9} from '../types/index.js'
10import { Constants } from '../utils/index.js'
11
12export class OCPPError extends BaseError {
13 code: ErrorType
14 command?: RequestCommand | IncomingRequestCommand
15 details?: JsonType
16
17 constructor (
18 code: ErrorType,
19 message: string,
20 command?: RequestCommand | IncomingRequestCommand,
21 details?: JsonType
22 ) {
23 super(message)
24
25 this.code = code
26 this.command = command ?? (Constants.UNKNOWN_COMMAND as RequestCommand | IncomingRequestCommand)
27 this.details = details
28 }
29}