@actuallab/rpc 12.3.79 → 12.3.81

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/index.cjs CHANGED
@@ -41,6 +41,7 @@ __export(index_exports, {
41
41
  RpcClientPeer: () => RpcClientPeer,
42
42
  RpcClientPeerReconnectDelayer: () => RpcClientPeerReconnectDelayer,
43
43
  RpcConnectionState: () => RpcConnectionState,
44
+ RpcError: () => RpcError,
44
45
  RpcHub: () => RpcHub,
45
46
  RpcInboundCall: () => RpcInboundCall,
46
47
  RpcInboundCallTracker: () => RpcInboundCallTracker,
@@ -862,6 +863,17 @@ var RpcInboundCallTracker = class {
862
863
  }
863
864
  };
864
865
 
866
+ // src/rpc-error.ts
867
+ var RpcError = class extends Error {
868
+ typeName;
869
+ constructor(message, typeName) {
870
+ super(message);
871
+ this.name = "RpcError";
872
+ if (typeName !== void 0)
873
+ this.typeName = typeName;
874
+ }
875
+ };
876
+
865
877
  // src/increasing-seq-compressor.ts
866
878
  var IncreasingSeqCompressor = {
867
879
  /**
@@ -1788,12 +1800,17 @@ var RpcSystemCallHandler = class {
1788
1800
  const errorInfo = args[0];
1789
1801
  const msg = errorInfo?.Message ?? errorInfo?.message ?? "RPC error";
1790
1802
  const errorType = errorInfo?.TypeRef ?? errorInfo?.typeRef;
1791
- if (errorType !== null && typeof errorType === "object") {
1803
+ let typeName;
1804
+ if (typeof errorType === "string") {
1805
+ const commaIdx = errorType.indexOf(",");
1806
+ typeName = commaIdx >= 0 ? errorType.slice(0, commaIdx) : errorType;
1807
+ } else if (errorType !== null && typeof errorType === "object") {
1792
1808
  const t = errorType;
1793
- if (t.TypeName === "RpcRerouteException" || t.typeName === "RpcRerouteException")
1794
- warnLog5?.log("Got RpcRerouteException from remote peer:", msg);
1809
+ typeName = t.TypeName ?? t.typeName;
1795
1810
  }
1796
- call.result.reject(new Error(msg));
1811
+ if (typeName === "ActualLab.Rpc.RpcRerouteException")
1812
+ warnLog5?.log("Got RpcRerouteException from remote peer:", msg);
1813
+ call.result.reject(new RpcError(msg, typeName));
1797
1814
  }
1798
1815
  break;
1799
1816
  }
@@ -4098,6 +4115,7 @@ var RpcPeerStateMonitor = class {
4098
4115
  RpcClientPeer,
4099
4116
  RpcClientPeerReconnectDelayer,
4100
4117
  RpcConnectionState,
4118
+ RpcError,
4101
4119
  RpcHub,
4102
4120
  RpcInboundCall,
4103
4121
  RpcInboundCallTracker,