1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | Object.defineProperty(exports, "__esModule", { value: true });
|
7 | exports.isEntityNotFoundError = exports.EntityNotFoundError = void 0;
|
8 | class EntityNotFoundError extends Error {
|
9 | constructor(entityOrName, entityId, extraProperties) {
|
10 | const entityName = typeof entityOrName === 'string'
|
11 | ? entityOrName
|
12 | : entityOrName.modelName || entityOrName.name;
|
13 | const quotedId = JSON.stringify(entityId);
|
14 | super(`Entity not found: ${entityName} with id ${quotedId}`);
|
15 | Error.captureStackTrace(this, this.constructor);
|
16 | this.code = 'ENTITY_NOT_FOUND';
|
17 | this.entityName = entityName;
|
18 | this.entityId = entityId;
|
19 | Object.assign(this, extraProperties);
|
20 | }
|
21 | }
|
22 | exports.EntityNotFoundError = EntityNotFoundError;
|
23 |
|
24 | function isEntityNotFoundError(e) {
|
25 | return e instanceof EntityNotFoundError;
|
26 | }
|
27 | exports.isEntityNotFoundError = isEntityNotFoundError;
|
28 |
|
\ | No newline at end of file |