How to use aggregate-error - 2 common examples

To help you get started, we’ve selected a few aggregate-error examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeit / now / packages / now-build-utils / src / detectors / index.ts View on Github external
}).catch(err => {
        errors.push(err);
        if (--unresolved === 0) {
          reject(new AggregateError(errors));
        }
      });
    }
github ardatan / graphql-toolkit / packages / common / src / validate-documents.ts View on Github external
if (loadDocumentErrors.length > 0) {
    const errors: Error[] = [];

    for (const loadDocumentError of loadDocumentErrors) {
      for (const graphQLError of loadDocumentError.errors) {
        const error = new Error();
        error.name = 'GraphQLDocumentError';
        error.message = `${error.name}: ${graphQLError.message}`;
        error.stack = error.message;
        graphQLError.locations.forEach(location => (error.stack += `\n    at ${loadDocumentError.filePath}:${location.line}:${location.column}`));

        errors.push(error);
      }
    }

    throw new AggregateError(errors);
  }
}

aggregate-error

Create an error from multiple errors

MIT
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis

Popular aggregate-error functions