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.
@@ -6171,10 +6171,6 @@ declare class RPCFrameworkError extends RPCGenericError {
6171
6171
  constructor(message?: string, details?: Record<string, unknown>);
6172
6172
  }
6173
6173
 
6174
- /**
6175
- * Instantiate a typed RPCError from a string error code.
6176
- * Returns an RPCGenericError if the code is not recognized.
6177
- */
6178
6174
  declare function createRPCError(code: string, message?: string, details?: Record<string, unknown>): RPCError;
6179
6175
  /**
6180
6176
  * Convert an Error into a plain, JSON-safe object.
package/dist/browser.d.ts CHANGED
@@ -6171,10 +6171,6 @@ declare class RPCFrameworkError extends RPCGenericError {
6171
6171
  constructor(message?: string, details?: Record<string, unknown>);
6172
6172
  }
6173
6173
 
6174
- /**
6175
- * Instantiate a typed RPCError from a string error code.
6176
- * Returns an RPCGenericError if the code is not recognized.
6177
- */
6178
6174
  declare function createRPCError(code: string, message?: string, details?: Record<string, unknown>): RPCError;
6179
6175
  /**
6180
6176
  * Convert an Error into a plain, JSON-safe object.
package/dist/browser.js CHANGED
@@ -602,27 +602,37 @@ var NOOP_LOGGER = {
602
602
  };
603
603
 
604
604
  // src/browser/util.ts
605
- var RPC_ERROR_REGISTRY = /* @__PURE__ */ new Map([
606
- ["GenericError", RPCGenericError],
607
- ["RpcFrameworkError", RPCFrameworkError],
608
- ["MessageTypeNotSupported", RPCMessageTypeNotSupportedError],
609
- ["NotImplemented", RPCNotImplementedError],
610
- ["NotSupported", RPCNotSupportedError],
611
- ["InternalError", RPCInternalError],
612
- ["ProtocolError", RPCProtocolError],
613
- ["SecurityError", RPCSecurityError],
614
- ["FormatViolation", RPCFormatViolationError],
615
- ["FormationViolation", RPCFormationViolationError],
616
- ["PropertyConstraintViolation", RPCPropertyConstraintViolationError],
617
- [
618
- "OccurrenceConstraintViolation",
619
- RPCOccurrenceConstraintViolationError
620
- ],
621
- ["TypeConstraintViolation", RPCTypeConstraintViolationError]
622
- ]);
623
605
  function createRPCError(code, message, details = {}) {
624
- const Ctor = RPC_ERROR_REGISTRY.get(code) ?? RPCGenericError;
625
- return new Ctor(message, details);
606
+ switch (code) {
607
+ case "GenericError":
608
+ return new RPCGenericError(message, details);
609
+ case "RpcFrameworkError":
610
+ return new RPCFrameworkError(message, details);
611
+ case "MessageTypeNotSupported":
612
+ return new RPCMessageTypeNotSupportedError(message, details);
613
+ case "NotImplemented":
614
+ return new RPCNotImplementedError(message, details);
615
+ case "NotSupported":
616
+ return new RPCNotSupportedError(message, details);
617
+ case "InternalError":
618
+ return new RPCInternalError(message, details);
619
+ case "ProtocolError":
620
+ return new RPCProtocolError(message, details);
621
+ case "SecurityError":
622
+ return new RPCSecurityError(message, details);
623
+ case "FormatViolation":
624
+ return new RPCFormatViolationError(message, details);
625
+ case "FormationViolation":
626
+ return new RPCFormationViolationError(message, details);
627
+ case "PropertyConstraintViolation":
628
+ return new RPCPropertyConstraintViolationError(message, details);
629
+ case "OccurrenceConstraintViolation":
630
+ return new RPCOccurrenceConstraintViolationError(message, details);
631
+ case "TypeConstraintViolation":
632
+ return new RPCTypeConstraintViolationError(message, details);
633
+ default:
634
+ return new RPCGenericError(message, details);
635
+ }
626
636
  }
627
637
  var ERROR_PROPERTIES = [
628
638
  "name",