ocpp-ws-io 2.1.8 → 2.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.mjs CHANGED
@@ -554,27 +554,37 @@ var NOOP_LOGGER = {
554
554
  };
555
555
 
556
556
  // src/browser/util.ts
557
- var RPC_ERROR_REGISTRY = /* @__PURE__ */ new Map([
558
- ["GenericError", RPCGenericError],
559
- ["RpcFrameworkError", RPCFrameworkError],
560
- ["MessageTypeNotSupported", RPCMessageTypeNotSupportedError],
561
- ["NotImplemented", RPCNotImplementedError],
562
- ["NotSupported", RPCNotSupportedError],
563
- ["InternalError", RPCInternalError],
564
- ["ProtocolError", RPCProtocolError],
565
- ["SecurityError", RPCSecurityError],
566
- ["FormatViolation", RPCFormatViolationError],
567
- ["FormationViolation", RPCFormationViolationError],
568
- ["PropertyConstraintViolation", RPCPropertyConstraintViolationError],
569
- [
570
- "OccurrenceConstraintViolation",
571
- RPCOccurrenceConstraintViolationError
572
- ],
573
- ["TypeConstraintViolation", RPCTypeConstraintViolationError]
574
- ]);
575
557
  function createRPCError(code, message, details = {}) {
576
- const Ctor = RPC_ERROR_REGISTRY.get(code) ?? RPCGenericError;
577
- return new Ctor(message, details);
558
+ switch (code) {
559
+ case "GenericError":
560
+ return new RPCGenericError(message, details);
561
+ case "RpcFrameworkError":
562
+ return new RPCFrameworkError(message, details);
563
+ case "MessageTypeNotSupported":
564
+ return new RPCMessageTypeNotSupportedError(message, details);
565
+ case "NotImplemented":
566
+ return new RPCNotImplementedError(message, details);
567
+ case "NotSupported":
568
+ return new RPCNotSupportedError(message, details);
569
+ case "InternalError":
570
+ return new RPCInternalError(message, details);
571
+ case "ProtocolError":
572
+ return new RPCProtocolError(message, details);
573
+ case "SecurityError":
574
+ return new RPCSecurityError(message, details);
575
+ case "FormatViolation":
576
+ return new RPCFormatViolationError(message, details);
577
+ case "FormationViolation":
578
+ return new RPCFormationViolationError(message, details);
579
+ case "PropertyConstraintViolation":
580
+ return new RPCPropertyConstraintViolationError(message, details);
581
+ case "OccurrenceConstraintViolation":
582
+ return new RPCOccurrenceConstraintViolationError(message, details);
583
+ case "TypeConstraintViolation":
584
+ return new RPCTypeConstraintViolationError(message, details);
585
+ default:
586
+ return new RPCGenericError(message, details);
587
+ }
578
588
  }
579
589
  var ERROR_PROPERTIES = [
580
590
  "name",