UNPKG

1.33 kBJavaScriptView Raw
1"use strict";
2// Copyright IBM Corp. and LoopBack contributors 2018,2019. All Rights Reserved.
3// Node module: @loopback/repository
4// This file is licensed under the MIT License.
5// License text available at https://opensource.org/licenses/MIT
6Object.defineProperty(exports, "__esModule", { value: true });
7exports.isInvalidRelationError = exports.InvalidRelationError = void 0;
8class InvalidRelationError extends Error {
9 constructor(reason, relationMeta, extraProperties) {
10 const { name, type, source } = relationMeta;
11 const model = (source === null || source === void 0 ? void 0 : source.modelName) || '<Unknown Model>';
12 const message = `Invalid ${type} definition for ${model}#${name}: ${reason}`;
13 super(message);
14 Error.captureStackTrace(this, this.constructor);
15 this.code = 'INVALID_RELATION_DEFINITION';
16 this.relationName = name;
17 this.relationType = type;
18 this.sourceModelName = model;
19 Object.assign(this, extraProperties);
20 }
21}
22exports.InvalidRelationError = InvalidRelationError;
23// eslint-disable-next-line @typescript-eslint/no-explicit-any
24function isInvalidRelationError(e) {
25 return e instanceof InvalidRelationError;
26}
27exports.isInvalidRelationError = isInvalidRelationError;
28//# sourceMappingURL=invalid-relation.error.js.map
\No newline at end of file