UNPKG

1.26 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var tslib_1 = require("tslib");
4/**
5 * Thrown when user tries to create entity id map from the mixed id value,
6 * but id value is a single value when entity requires multiple values.
7 */
8var CannotCreateEntityIdMapError = /** @class */ (function (_super) {
9 tslib_1.__extends(CannotCreateEntityIdMapError, _super);
10 function CannotCreateEntityIdMapError(metadata, id) {
11 var _this = _super.call(this) || this;
12 _this.name = "CannotCreateEntityIdMapError";
13 Object.setPrototypeOf(_this, CannotCreateEntityIdMapError.prototype);
14 var objectExample = metadata.primaryColumns.reduce(function (object, column, index) {
15 column.setEntityValue(object, index + 1);
16 return object;
17 }, {});
18 _this.message = "Cannot use given entity id \"" + id + "\" because \"" + metadata.targetName + "\" contains multiple primary columns, you must provide object in following form: " + JSON.stringify(objectExample) + " as an id.";
19 return _this;
20 }
21 return CannotCreateEntityIdMapError;
22}(Error));
23exports.CannotCreateEntityIdMapError = CannotCreateEntityIdMapError;
24
25//# sourceMappingURL=CannotCreateEntityIdMapError.js.map