UNPKG

ts-sql-query

Version:

Type-safe SQL query builder like QueryDSL or JOOQ in Java or Linq in .Net for TypeScript with MariaDB, MySql, Oracle, PostgreSql, Sqlite and SqlServer support.

83 lines (82 loc) 2.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.attachAdditionalError = exports.attachTransactionError = exports.attachRollbackError = exports.attachTransactionSource = exports.attachSource = void 0; function attachSource(error, source) { Object.defineProperty(error, 'source', { value: source, writable: true, enumerable: false, configurable: true }); error.stack = error.stack + '\nSource: ' + source.stack; return error; } exports.attachSource = attachSource; function attachTransactionSource(error, source) { Object.defineProperty(error, 'transactionSource', { value: source, writable: true, enumerable: false, configurable: true }); error.stack = error.stack + '\nTransaction source: ' + source.stack; return error; } exports.attachTransactionSource = attachTransactionSource; function attachRollbackError(error, source) { Object.defineProperty(error, 'rollbackError', { value: source, writable: true, enumerable: false, configurable: true }); if (source instanceof Error) { error.stack = error.stack + '\nRollback error: ' + source.stack; } else { error.stack = error.stack + '\nRollback error: ' + source; } return error; } exports.attachRollbackError = attachRollbackError; function attachTransactionError(error, source) { Object.defineProperty(error, 'transactionError', { value: source, writable: true, enumerable: false, configurable: true }); if (source instanceof Error) { error.stack = error.stack + '\nTransaction error: ' + source.stack; } else { error.stack = error.stack + '\nTransaction error: ' + source; } return error; } exports.attachTransactionError = attachTransactionError; function attachAdditionalError(error, additional, name) { let additionalErrors = error.additionalErrors; if (!additionalErrors) { additionalErrors = []; Object.defineProperty(error, 'additionalErrors', { value: additionalErrors, writable: true, enumerable: false, configurable: true }); } additionalErrors.push(additional); if (additional instanceof Error) { error.stack = error.stack + '\n-------------------------------------------------------------\n' + 'An additional error happens during the ' + name + ' processing in another handler.\n' + 'Additional error: ' + additional.stack; } else { error.stack = error.stack + '\n-------------------------------------------------------------\n' + 'An additional error happens during the ' + name + ' processing in another handler.\n' + 'Additional error: ' + additional; } return error; } exports.attachAdditionalError = attachAdditionalError;