UNPKG

sequelize

Version:

Sequelize is a promise-based Node.js ORM tool for Postgres, MySQL, MariaDB, SQLite, Microsoft SQL Server, Amazon Redshift and Snowflake’s Data Cloud. It features solid transaction support, relations, eager and lazy loading, read replication and more.

32 lines (27 loc) 784 B
import BaseError from './base-error'; /** * A wrapper for multiple Errors * * @param errors Array of errors */ class AggregateError extends BaseError { errors: Array<AggregateError | Error>; constructor(errors: Array<AggregateError | Error>) { super(); this.errors = errors; this.name = 'AggregateError'; } toString(): string { const message = `AggregateError of:\n${this.errors .map((error: Error | AggregateError) => error === this ? '[Circular AggregateError]' : error instanceof AggregateError ? String(error).replace(/\n$/, '').replace(/^/gm, ' ') : String(error).replace(/^/gm, ' ').substring(2) ) .join('\n')}\n`; return message; } } export default AggregateError;