LibJS: Update spec links and steps for the Error.isError proposal

This proposal reached stage 4 and was merged into ECMA-262. See:
caa0482
This commit is contained in:
Timothy Flynn 2025-10-01 11:58:16 -04:00 committed by Jelle Raaijmakers
commit cb56ea7e24
Notes: github-actions[bot] 2025-10-03 07:05:07 +00:00
3 changed files with 5 additions and 13 deletions

View file

@ -123,13 +123,15 @@ ThrowCompletionOr<GC::Ref<Object>> ErrorConstructor::construct(FunctionObject& n
JS_ENUMERATE_NATIVE_ERRORS
#undef __JS_ENUMERATE
// 20.5.2.1 Error.isError ( arg ), https://tc39.es/proposal-is-error/#sec-error.iserror
// 20.5.2.1 Error.isError ( arg ), https://tc39.es/ecma262/#sec-error.iserror
JS_DEFINE_NATIVE_FUNCTION(ErrorConstructor::is_error)
{
auto arg = vm.argument(0);
// 1. Return IsError(arg).
return Value(arg.is_error());
// 1. If arg is not an Object, return false.
// 2. If arg does not have an [[ErrorData]] internal slot, return false.
// 3. Return true.
return arg.is_object() && is<Error>(arg.as_object());
}
}