@clickup/ent-framework
Version:
A PostgreSQL graph-database-alike library with microsharding and row-level security
29 lines • 1.12 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.EntNotFoundError = void 0;
const misc_1 = require("../../internal/misc");
const EntAccessError_1 = require("./EntAccessError");
/**
* Error: non-existing ID in the database (failed loadX() call), or non-existing
* Ent (failed loadByX() call). Notice that `where` data is intentionally NOT
* considered as private and may be delivered to the client.
*/
class EntNotFoundError extends EntAccessError_1.EntAccessError {
constructor(entName, where, cause = null) {
super(entName, `${entName} not found: ${whereToText(where)}`, cause);
this.where = where;
}
}
exports.EntNotFoundError = EntNotFoundError;
function whereToText(where) {
if (Object.keys(where).length === 1) {
const [k, v] = Object.entries(where)[0];
return `${k}=${(0, misc_1.sanitizeIDForDebugPrinting)(v)}`;
}
return ("(" +
Object.keys(where).join(",") +
")=(" +
Object.values(where).map(misc_1.sanitizeIDForDebugPrinting).join(",") +
")");
}
//# sourceMappingURL=EntNotFoundError.js.map
;