@ember-data/store 5.4.0-alpha.58 → 5.4.0-alpha.59

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/addon/-private.js CHANGED
@@ -1 +1 @@
1
- export { A as ARRAY_SIGNAL, b as AdapterPopulatedRecordArray, C as CacheHandler, I as IdentifierArray, M as MUTATE, I as RecordArray, R as RecordArrayManager, d as SOURCE, S as Store, j as StoreMap, _ as _clearCaches, l as _deprecatingNormalize, a as coerceId, c as constructResource, e as ensureStringId, f as fastPush, i as isStableIdentifier, n as notifyArray, p as peekCache, r as recordIdentifierFor, g as removeRecordDataFor, k as setCacheFor, h as setRecordIdentifier, s as storeFor } from "./cache-handler-DOlgnS0T";
1
+ export { A as ARRAY_SIGNAL, b as AdapterPopulatedRecordArray, C as CacheHandler, I as IdentifierArray, M as MUTATE, I as RecordArray, R as RecordArrayManager, d as SOURCE, S as Store, j as StoreMap, _ as _clearCaches, l as _deprecatingNormalize, a as coerceId, c as constructResource, e as ensureStringId, f as fastPush, i as isStableIdentifier, n as notifyArray, p as peekCache, r as recordIdentifierFor, g as removeRecordDataFor, k as setCacheFor, h as setRecordIdentifier, s as storeFor } from "./cache-handler-DoL926UP";
@@ -5603,10 +5603,18 @@ function fetchContentAndHydrate(next, context, identifier, shouldFetch, shouldBa
5603
5603
  }]
5604
5604
  });
5605
5605
  }
5606
+ function isAggregateError(error) {
5607
+ return error instanceof AggregateError || error.name === 'AggregateError' && Array.isArray(error.errors);
5608
+ }
5609
+ // TODO @runspired, consider if we should deep freeze errors (potentially only in debug) vs cloning them
5606
5610
  function cloneError(error) {
5607
- const cloned = new Error(error.message);
5611
+ const isAggregate = isAggregateError(error);
5612
+ const cloned = isAggregate ? new AggregateError(structuredClone(error.errors), error.message) : new Error(error.message);
5608
5613
  cloned.stack = error.stack;
5609
5614
  cloned.error = error.error;
5615
+
5616
+ // copy over enumerable properties
5617
+ Object.assign(cloned, error);
5610
5618
  return cloned;
5611
5619
  }
5612
5620