Merge branch 'main' into combined-prs-branch
[e-mobility-charging-stations-simulator.git] / src / exception / OCPPError.ts
index c5d25ddc23d402070437d511dce6a3ea11156bc3..5736ad277a1b981907c052eadc9c06aba04b342a 100644 (file)
@@ -1,6 +1,6 @@
 // Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved.
 
-import { BaseError } from './internal';
+import { BaseError } from './BaseError';
 import {
   ErrorType,
   type IncomingRequestCommand,
@@ -18,12 +18,13 @@ export class OCPPError extends BaseError {
     code: ErrorType,
     message: string,
     command?: RequestCommand | IncomingRequestCommand,
-    details?: JsonType
+    details?: JsonType,
   ) {
     super(message);
 
-    this.code = code ?? ErrorType.GENERIC_ERROR;
-    this.command = command;
-    this.details = details ?? Constants.EMPTY_FREEZED_OBJECT;
+    this.code = code;
+    this.command =
+      command ?? (Constants.UNKNOWN_COMMAND as RequestCommand | IncomingRequestCommand);
+    this.details = details;
   }
 }