Debian Codegraph @

js/src/tests/test262/built-ins/Error/isError/non-error-objects.js

raw
1 // |reftest| shell-option(--enable-error-iserror) skip-if(!Error.isError||!xulRuntime.shell) -- Error.isError is not enabled unconditionally, requires shell-options
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 false on non-Error objects
9 features: [Error.isError]
10 ---*/
11
12 assert.sameValue(Error.isError({}), false);
13 assert.sameValue(Error.isError([]), false);
14 assert.sameValue(Error.isError(function () {}), false);
15 assert.sameValue(Error.isError(/a/g), false);
16
17 assert.sameValue(Error.isError(Error), false);
18 assert.sameValue(Error.isError(EvalError), false);
19 assert.sameValue(Error.isError(RangeError), false);
20 assert.sameValue(Error.isError(ReferenceError), false);
21 assert.sameValue(Error.isError(SyntaxError), false);
22 assert.sameValue(Error.isError(TypeError), false);
23 assert.sameValue(Error.isError(URIError), false);
24
25 if (typeof AggregateError !== 'undefined') {
26 assert.sameValue(Error.isError(AggregateError), false);
27 }
28 if (typeof SuppressedError !== 'undefined') {
29 assert.sameValue(Error.isError(SuppressedError), false);
30 }
31
32 reportCompare(0, 0);