1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export function DimensionError(actual, expected, relation) {
|
11 | if (!(this instanceof DimensionError)) {
|
12 | throw new SyntaxError('Constructor must be called with the new operator');
|
13 | }
|
14 |
|
15 | this.actual = actual;
|
16 | this.expected = expected;
|
17 | this.relation = relation;
|
18 | this.message = 'Dimension mismatch (' + (Array.isArray(actual) ? '[' + actual.join(', ') + ']' : actual) + ' ' + (this.relation || '!=') + ' ' + (Array.isArray(expected) ? '[' + expected.join(', ') + ']' : expected) + ')';
|
19 | this.stack = new Error().stack;
|
20 | }
|
21 | DimensionError.prototype = new RangeError();
|
22 | DimensionError.prototype.constructor = RangeError;
|
23 | DimensionError.prototype.name = 'DimensionError';
|
24 | DimensionError.prototype.isDimensionError = true; |
\ | No newline at end of file |