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