errors.js (990B)
1 // |reftest| skip-if(!Error.isError) -- Error.isError is not enabled unconditionally 2 // Copyright (C) 2024 Jordan Harband. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-error.iserror 7 description: > 8 Returns true on Error and Error subclass instances 9 features: [Error.isError] 10 ---*/ 11 12 assert.sameValue(Error.isError(new Error()), true); 13 assert.sameValue(Error.isError(new EvalError()), true); 14 assert.sameValue(Error.isError(new RangeError()), true); 15 assert.sameValue(Error.isError(new ReferenceError()), true); 16 assert.sameValue(Error.isError(new SyntaxError()), true); 17 assert.sameValue(Error.isError(new TypeError()), true); 18 assert.sameValue(Error.isError(new URIError()), true); 19 20 if (typeof AggregateError !== 'undefined') { 21 assert.sameValue(Error.isError(new AggregateError([])), true); 22 } 23 if (typeof SuppressedError !== 'undefined') { 24 assert.sameValue(Error.isError(new SuppressedError()), true); 25 } 26 27 reportCompare(0, 0);