@riverbankcms/sdk 0.7.3 → 0.7.5

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.
@@ -2331,7 +2331,7 @@ var SimpleCache = class {
2331
2331
  };
2332
2332
 
2333
2333
  // src/version.ts
2334
- var SDK_VERSION = "0.7.3";
2334
+ var SDK_VERSION = "0.7.5";
2335
2335
 
2336
2336
  // src/client/error.ts
2337
2337
  var RiverbankApiError = class _RiverbankApiError extends Error {
@@ -2424,6 +2424,54 @@ var RiverbankApiError = class _RiverbankApiError extends Error {
2424
2424
  isServerError() {
2425
2425
  return this.code.startsWith("server:");
2426
2426
  }
2427
+ /**
2428
+ * Returns a human-readable string representation of the error.
2429
+ * Includes all key details for debugging.
2430
+ *
2431
+ * @example
2432
+ * "RiverbankApiError: Content keys cannot access preview content | Code: auth:forbidden | Status: 401 | RequestId: req-abc123"
2433
+ */
2434
+ toString() {
2435
+ const parts = [`RiverbankApiError: ${this.message}`];
2436
+ if (this.code) parts.push(`Code: ${this.code}`);
2437
+ if (this.status) parts.push(`Status: ${this.status}`);
2438
+ if (this.requestId) parts.push(`RequestId: ${this.requestId}`);
2439
+ return parts.join(" | ");
2440
+ }
2441
+ /**
2442
+ * Custom Node.js inspect output for better console.log display.
2443
+ * This ensures that console.log(error) shows all relevant details
2444
+ * instead of just "[Object]" for nested properties.
2445
+ */
2446
+ [Symbol.for("nodejs.util.inspect.custom")]() {
2447
+ return this.toDetailedString();
2448
+ }
2449
+ /**
2450
+ * Returns a detailed multi-line string for debugging.
2451
+ * Used by the Node.js inspect symbol for console output.
2452
+ */
2453
+ toDetailedString() {
2454
+ const lines = [
2455
+ `RiverbankApiError: ${this.message}`,
2456
+ ` Code: ${this.code}`,
2457
+ ` Status: ${this.status}`,
2458
+ ` RequestId: ${this.requestId}`,
2459
+ ` Timestamp: ${this.timestamp}`
2460
+ ];
2461
+ if (this.isRetryable) {
2462
+ lines.push(` Retryable: true`);
2463
+ if (this.retryAfterMs) {
2464
+ lines.push(` RetryAfter: ${this.retryAfterMs}ms`);
2465
+ }
2466
+ }
2467
+ if (this.fieldErrors && this.fieldErrors.length > 0) {
2468
+ lines.push(" FieldErrors:");
2469
+ this.fieldErrors.forEach((fe) => {
2470
+ lines.push(` - ${fe.field}: ${fe.message}`);
2471
+ });
2472
+ }
2473
+ return lines.join("\n");
2474
+ }
2427
2475
  };
2428
2476
 
2429
2477
  // src/client/resilience.ts
@@ -2581,7 +2629,19 @@ async function fetchWithTimeoutAndRetry(fetcher, config) {
2581
2629
  }
2582
2630
  throw lastError;
2583
2631
  }
2632
+ function isAbortError(error) {
2633
+ if (typeof DOMException !== "undefined" && error instanceof DOMException && error.name === "AbortError") {
2634
+ return true;
2635
+ }
2636
+ if (error instanceof Error && error.name === "AbortError") {
2637
+ return true;
2638
+ }
2639
+ return false;
2640
+ }
2584
2641
  function shouldRetryError(error, customRetryOn) {
2642
+ if (isAbortError(error)) {
2643
+ return false;
2644
+ }
2585
2645
  if (customRetryOn) {
2586
2646
  const statusCode = error instanceof RiverbankApiError ? error.status : void 0;
2587
2647
  return customRetryOn(error, statusCode);
@@ -2625,7 +2685,7 @@ var DEFAULT_SERVER_TIMEOUT_MS = 8e3;
2625
2685
  function generateRequestId2() {
2626
2686
  return `req-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
2627
2687
  }
2628
- function isAbortError(error) {
2688
+ function isAbortError2(error) {
2629
2689
  if (error instanceof DOMException && error.name === "AbortError") {
2630
2690
  return true;
2631
2691
  }
@@ -2663,7 +2723,7 @@ function getNetworkErrorCode(error) {
2663
2723
  return "network:connection_error";
2664
2724
  }
2665
2725
  function convertToTypedError(error) {
2666
- if (isAbortError(error)) {
2726
+ if (isAbortError2(error)) {
2667
2727
  throw error;
2668
2728
  }
2669
2729
  if (error instanceof ApiEnvelopeError) {
@@ -3049,4 +3109,4 @@ export {
3049
3109
  init_loader,
3050
3110
  createRiverbankClient
3051
3111
  };
3052
- //# sourceMappingURL=chunk-NFQLH5IA.mjs.map
3112
+ //# sourceMappingURL=chunk-2NBNOY3C.mjs.map