@moonpay/cli 0.6.12 → 0.6.13

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.
@@ -235,9 +235,21 @@ async function callTool(baseUrl, toolName, params) {
235
235
  }
236
236
  }
237
237
  }
238
- const data = await res.json();
238
+ if (res.status === 429) {
239
+ throw new Error("Rate limit exceeded. Please wait a moment and try again.");
240
+ }
239
241
  if (res.status === 401) {
240
- throw new Error("This command requires a MoonPay Agents account. Run `moonpay login` first.");
242
+ throw new Error("This command requires a MoonPay CLI account. Run `moonpay login` first.");
243
+ }
244
+ const text = await res.text();
245
+ if (!text) {
246
+ throw new Error(`Empty response from server (${res.status})`);
247
+ }
248
+ let data;
249
+ try {
250
+ data = JSON.parse(text);
251
+ } catch {
252
+ throw new Error(`Unexpected response from server (${res.status})`);
241
253
  }
242
254
  if (res.status < 200 || res.status >= 300) {
243
255
  const err = data;
@@ -7711,4 +7723,4 @@ export {
7711
7723
  consentCheck,
7712
7724
  LOCAL_TOOLS
7713
7725
  };
7714
- //# sourceMappingURL=chunk-2XX5YJ2D.js.map
7726
+ //# sourceMappingURL=chunk-AFUYZK7C.js.map