@toon-protocol/client-mcp 0.12.1 → 0.12.2

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.
@@ -15,7 +15,7 @@ import {
15
15
  isEventExpired,
16
16
  parseIlpPeerInfo,
17
17
  readConfigFile
18
- } from "./chunk-W6T6ZK7U.js";
18
+ } from "./chunk-AYIP46A2.js";
19
19
  import {
20
20
  __require
21
21
  } from "./chunk-F22GNSF6.js";
@@ -2785,10 +2785,27 @@ function mapError(reply, err) {
2785
2785
  if (err instanceof Error && err.name === "SettleTooEarlyError") {
2786
2786
  return sendError(reply, 425, "settle_too_early", { detail: err.message, retryable: true });
2787
2787
  }
2788
+ const funding = findChannelFundingError(err);
2789
+ if (funding) {
2790
+ return sendError(reply, 402, "insufficient_gas", {
2791
+ detail: funding.message,
2792
+ retryable: true
2793
+ });
2794
+ }
2788
2795
  return sendError(reply, 500, "internal_error", {
2789
2796
  detail: err instanceof Error ? err.message : String(err)
2790
2797
  });
2791
2798
  }
2799
+ function findChannelFundingError(err) {
2800
+ let cur = err;
2801
+ for (let i = 0; i < 10 && cur != null; i++) {
2802
+ if (cur instanceof Error && cur.name === "ChannelFundingError") {
2803
+ return cur;
2804
+ }
2805
+ cur = cur instanceof Error ? cur.cause : void 0;
2806
+ }
2807
+ return void 0;
2808
+ }
2792
2809
  function sendError(reply, status, error, extra = {}) {
2793
2810
  return reply.status(status).send({
2794
2811
  error,
@@ -2807,4 +2824,4 @@ export {
2807
2824
  PublishRejectedError,
2808
2825
  registerRoutes
2809
2826
  };
2810
- //# sourceMappingURL=chunk-HLATGATX.js.map
2827
+ //# sourceMappingURL=chunk-EAPVMGLZ.js.map