UNPKG

@clickup/ent-framework

Version:

A PostgreSQL graph-database-alike library with microsharding and row-level security

33 lines 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ClientError = void 0; const misc_1 = require("../internal/misc"); /** * Encapsulates the error thrown when running a Client query. The object also * carries suggestions, what to do next. */ class ClientError extends Error { constructor(cause, where, postAction, kind, abbreviation, comment) { super((0, misc_1.addSentenceSuffixes)(typeof cause === "string" ? cause : `${cause?.message}`, ` (${abbreviation})`, comment ? `\n${comment}` : undefined)); this.cause = cause; this.postAction = postAction; this.kind = kind; this.abbreviation = abbreviation; this.comment = comment; Object.defineProperty(this, "name", { value: this.constructor.name, writable: true, enumerable: false, }); if (typeof cause === "string") { this.cause = Error(cause); } else { (0, misc_1.copyStack)(this, cause); } this.stack += `\n on ${where}`; delete cause?.stack; } } exports.ClientError = ClientError; //# sourceMappingURL=ClientError.js.map