@domino-sdk/relay 1.0.0-next.13 → 1.0.0-next.14

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.
@@ -2,7 +2,7 @@ import {
2
2
  authoringIdentityShape,
3
3
  normalizeAuthoringIdentity,
4
4
  validateAuthoringIdentity
5
- } from "./chunk-OA2KMQVZ.js";
5
+ } from "./chunk-TLGCEVG5.js";
6
6
  import {
7
7
  entitlementSchema,
8
8
  identifier,
@@ -265,6 +265,15 @@ var RelayError = class extends RequestError {
265
265
  this.missing = details.missing ?? [];
266
266
  }
267
267
  };
268
+ function asRelayError(cause, fallback = "Request failed") {
269
+ if (isRelayError(cause)) {
270
+ return cause;
271
+ }
272
+ return new RelayError(
273
+ cause instanceof Error && cause.message ? cause.message : fallback,
274
+ { kind: "client", cause }
275
+ );
276
+ }
268
277
  function clientError(message, code, details = {}) {
269
278
  return new RelayError(message, { ...details, kind: "client", code });
270
279
  }
@@ -939,6 +948,7 @@ export {
939
948
  RelayErrorCode,
940
949
  isRelayError,
941
950
  RelayError,
951
+ asRelayError,
942
952
  clientError,
943
953
  parseInput,
944
954
  profileVisibilitySchema,