UNPKG

ts-db-helper

Version:
39 lines 1.28 kB
/** * @class QueryError is thrown when a query fails * * @see Error * @author Olivier Margarit * @since 0.1 */ var QueryError = /** @class */ (function () { /** * @public * @constructor * @param {string} message message explaining in details error * @param {string} query query text that did failed execution * @param {string} params query params of the failed query */ function QueryError(message, query, params) { var _newTarget = this.constructor; this.message = message; this.query = query; this.params = params; Object.setPrototypeOf(this, _newTarget.prototype); Error.captureStackTrace(this, this.constructor); this.message = message; this.name = 'query error'; } /** * @public * @method toString convert error to string * * @return {string} string represation of the error */ QueryError.prototype.toString = function () { return this.name + '\n' + this.message + (this.query ? '\nquery: ' + this.query : '') + (this.params ? '\nparams: ' + this.params : ''); }; return QueryError; }()); export { QueryError }; //# sourceMappingURL=query.error.js.map