UNPKG

@helia/verified-fetch

Version:

A fetch-like API for obtaining verified & trustless IPFS content on the web

20 lines 619 B
function isAggregateError(err) { return err instanceof AggregateError || (err?.name === 'AggregateError' && Array.isArray(err?.errors)); } /** * Error instance properties are not enumerable so we must transform the error * into a plain object if we want to pass it to `JSON.stringify` or similar. */ export function errorToObject(err) { let errors; if (isAggregateError(err)) { errors = err.errors.map(err => errorToObject(err)); } return { name: err.name, message: err.message, stack: err.stack, errors }; } //# sourceMappingURL=error-to-object.js.map