Lines Matching full:error
6 const theError = new Error('Some error');
7 const theTypeError = new TypeError('Some type error');
8 const theSyntaxError = new SyntaxError('Some syntax error');
9 const theRangeError = new RangeError('Some type error');
10 const theReferenceError = new ReferenceError('Some reference error');
11 const theURIError = new URIError('Some URI error');
12 const theEvalError = new EvalError('Some eval error');
14 class MyError extends Error { }
17 // Test that native error object is correctly classed
20 // Test that native type error object is correctly classed
23 // Test that native syntax error object is correctly classed
26 // Test that native range error object is correctly classed
29 // Test that native reference error object is correctly classed
32 // Test that native URI error object is correctly classed
35 // Test that native eval error object is correctly classed
38 // Test that class derived from native error is correctly classed
41 // Test that non-error object is correctly classed
44 // Test that non-error primitive is correctly classed
49 }, /^Error: existing error$/);
53 }, /^Error: error$/);
57 }, /^RangeError: range error$/);
61 }, /^TypeError: type error$/);
65 }, /^SyntaxError: syntax error$/);
80 message: 'Error [error]',
87 message: 'RangeError [range error]',
94 message: 'TypeError [type error]',
101 message: 'SyntaxError [syntax error]',
104 let error = test_error.createError(); variable
105 assert.ok(error instanceof Error, 'expected error to be an instance of Error');
106 assert.strictEqual(error.message, 'error');
108 error = test_error.createRangeError();
109 assert.ok(error instanceof RangeError,
110 'expected error to be an instance of RangeError');
111 assert.strictEqual(error.message, 'range error');
113 error = test_error.createTypeError();
114 assert.ok(error instanceof TypeError,
115 'expected error to be an instance of TypeError');
116 assert.strictEqual(error.message, 'type error');
118 error = test_error.createSyntaxError();
119 assert.ok(error instanceof SyntaxError,
120 'expected error to be an instance of SyntaxError');
121 assert.strictEqual(error.message, 'syntax error');
123 error = test_error.createErrorCode();
124 assert.ok(error instanceof Error, 'expected error to be an instance of Error');
125 assert.strictEqual(error.code, 'ERR_TEST_CODE');
126 assert.strictEqual(error.message, 'Error [error]');
127 assert.strictEqual(error.name, 'Error');
129 error = test_error.createRangeErrorCode();
130 assert.ok(error instanceof RangeError,
131 'expected error to be an instance of RangeError');
132 assert.strictEqual(error.message, 'RangeError [range error]');
133 assert.strictEqual(error.code, 'ERR_TEST_CODE');
134 assert.strictEqual(error.name, 'RangeError');
136 error = test_error.createTypeErrorCode();
137 assert.ok(error instanceof TypeError,
138 'expected error to be an instance of TypeError');
139 assert.strictEqual(error.message, 'TypeError [type error]');
140 assert.strictEqual(error.code, 'ERR_TEST_CODE');
141 assert.strictEqual(error.name, 'TypeError');
143 error = test_error.createSyntaxErrorCode();
144 assert.ok(error instanceof SyntaxError,
145 'expected error to be an instance of SyntaxError');
146 assert.strictEqual(error.message, 'SyntaxError [syntax error]');
147 assert.strictEqual(error.code, 'ERR_TEST_CODE');
148 assert.strictEqual(error.name, 'SyntaxError');