1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.isInvalidPolymorphismError = exports.InvalidPolymorphismError = void 0;
|
4 | class InvalidPolymorphismError extends Error {
|
5 | constructor(typeName, discriminator, extraProperties) {
|
6 | const message = discriminator
|
7 | ? `Invalid class name ${typeName} by discriminator ${discriminator}. Please check polymorphic types and the discriminator.`
|
8 | : `Invalid class name ${typeName}. Please check polymorphic types and the discriminator.`;
|
9 | super(message);
|
10 | Error.captureStackTrace(this, this.constructor);
|
11 | this.code = 'INVALID_POLYMORPHISM';
|
12 | Object.assign(this, extraProperties);
|
13 | }
|
14 | }
|
15 | exports.InvalidPolymorphismError = InvalidPolymorphismError;
|
16 | function isInvalidPolymorphismError(
|
17 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
18 | e) {
|
19 | return e instanceof InvalidPolymorphismError;
|
20 | }
|
21 | exports.isInvalidPolymorphismError = isInvalidPolymorphismError;
|
22 |
|
\ | No newline at end of file |