@agentcash/router 0.4.2 → 0.4.4

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
@@ -144,11 +144,17 @@ function firePluginHook(plugin, method, ...args) {
144
144
  try {
145
145
  const result = fn.apply(plugin, args);
146
146
  if (result && typeof result.catch === "function") {
147
- result.catch(() => {
147
+ result.catch((error) => {
148
+ console.error(
149
+ `[router] ERROR ${method}: ${error instanceof Error ? error.message : String(error)}`
150
+ );
148
151
  });
149
152
  }
150
153
  return result;
151
- } catch {
154
+ } catch (error) {
155
+ console.error(
156
+ `[router] ERROR ${method}: ${error instanceof Error ? error.message : String(error)}`
157
+ );
152
158
  return void 0;
153
159
  }
154
160
  }
@@ -717,6 +723,7 @@ function createRequestHandler(routeEntry, handler, deps) {
717
723
  message: `Settlement failed: ${err instanceof Error ? err.message : String(err)}`,
718
724
  route: routeEntry.key
719
725
  });
726
+ return fail(500, "Settlement failed", meta, pluginCtx);
720
727
  }
721
728
  }
722
729
  finalize(response, rawResult, meta, pluginCtx);
package/dist/index.js CHANGED
@@ -110,11 +110,17 @@ function firePluginHook(plugin, method, ...args) {
110
110
  try {
111
111
  const result = fn.apply(plugin, args);
112
112
  if (result && typeof result.catch === "function") {
113
- result.catch(() => {
113
+ result.catch((error) => {
114
+ console.error(
115
+ `[router] ERROR ${method}: ${error instanceof Error ? error.message : String(error)}`
116
+ );
114
117
  });
115
118
  }
116
119
  return result;
117
- } catch {
120
+ } catch (error) {
121
+ console.error(
122
+ `[router] ERROR ${method}: ${error instanceof Error ? error.message : String(error)}`
123
+ );
118
124
  return void 0;
119
125
  }
120
126
  }
@@ -683,6 +689,7 @@ function createRequestHandler(routeEntry, handler, deps) {
683
689
  message: `Settlement failed: ${err instanceof Error ? err.message : String(err)}`,
684
690
  route: routeEntry.key
685
691
  });
692
+ return fail(500, "Settlement failed", meta, pluginCtx);
686
693
  }
687
694
  }
688
695
  finalize(response, rawResult, meta, pluginCtx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentcash/router",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Unified route builder for Next.js App Router APIs with x402, MPP, SIWX, and API key auth",
5
5
  "type": "module",
6
6
  "exports": {