Skip to content

Commit 098f221

Browse files
author
Fabrice Bellard
committed
added Error.isError() (bnoordhuis)
1 parent 9b935db commit 098f221

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

TODO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ Optimization ideas:
6262
Test262o: 0/11262 errors, 463 excluded
6363
Test262o commit: 7da91bceb9ce7613f87db47ddd1292a2dda58b42 (es5-tests branch)
6464

65-
Result: 47/79321 errors, 1617 excluded, 6767 skipped
65+
Result: 46/79346 errors, 1617 excluded, 6754 skipped
6666
Test262 commit: 4b5d36ab6ef2f59d0a8902cd383762547a3a74c4

quickjs.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39976,6 +39976,16 @@ static const JSCFunctionListEntry js_error_proto_funcs[] = {
3997639976
JS_PROP_STRING_DEF("message", "", JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE ),
3997739977
};
3997839978

39979+
static JSValue js_error_isError(JSContext *ctx, JSValueConst this_val,
39980+
int argc, JSValueConst *argv)
39981+
{
39982+
return JS_NewBool(ctx, JS_IsError(ctx, argv[0]));
39983+
}
39984+
39985+
static const JSCFunctionListEntry js_error_funcs[] = {
39986+
JS_CFUNC_DEF("isError", 1, js_error_isError),
39987+
};
39988+
3997939989
/* AggregateError */
3998039990

3998139991
/* used by C code. */
@@ -52277,6 +52287,7 @@ void JS_AddIntrinsicBaseObjects(JSContext *ctx)
5227752287
"Error", 1, JS_CFUNC_constructor_or_func_magic, -1);
5227852288
JS_NewGlobalCConstructor2(ctx, obj1,
5227952289
"Error", ctx->class_proto[JS_CLASS_ERROR]);
52290+
JS_SetPropertyFunctionList(ctx, obj1, js_error_funcs, countof(js_error_funcs));
5228052291

5228152292
/* Used to squelch a -Wcast-function-type warning. */
5228252293
JSCFunctionType ft = { .generic_magic = js_error_constructor };

test262.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ destructuring-assignment
103103
destructuring-binding
104104
dynamic-import
105105
error-cause
106-
Error.isError=skip
106+
Error.isError
107107
explicit-resource-management=skip
108108
exponentiation
109109
export-star-as-namespace-from-module

0 commit comments

Comments
 (0)