• Home
  • Raw
  • Download

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$/);
76 message: 'Error [error]'
83 message: 'RangeError [range error]'
90 message: 'TypeError [type error]'
93 let error = test_error.createError(); variable
94 assert.ok(error instanceof Error, 'expected error to be an instance of Error');
95 assert.strictEqual(error.message, 'error');
97 error = test_error.createRangeError();
98 assert.ok(error instanceof RangeError,
99 'expected error to be an instance of RangeError');
100 assert.strictEqual(error.message, 'range error');
102 error = test_error.createTypeError();
103 assert.ok(error instanceof TypeError,
104 'expected error to be an instance of TypeError');
105 assert.strictEqual(error.message, 'type error');
107 error = test_error.createErrorCode();
108 assert.ok(error instanceof Error, 'expected error to be an instance of Error');
109 assert.strictEqual(error.code, 'ERR_TEST_CODE');
110 assert.strictEqual(error.message, 'Error [error]');
111 assert.strictEqual(error.name, 'Error');
113 error = test_error.createRangeErrorCode();
114 assert.ok(error instanceof RangeError,
115 'expected error to be an instance of RangeError');
116 assert.strictEqual(error.message, 'RangeError [range error]');
117 assert.strictEqual(error.code, 'ERR_TEST_CODE');
118 assert.strictEqual(error.name, 'RangeError');
120 error = test_error.createTypeErrorCode();
121 assert.ok(error instanceof TypeError,
122 'expected error to be an instance of TypeError');
123 assert.strictEqual(error.message, 'TypeError [type error]');
124 assert.strictEqual(error.code, 'ERR_TEST_CODE');
125 assert.strictEqual(error.name, 'TypeError');