1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:17:45 +00:00

LibJS: Implement the Error Cause proposal

Currently stage 3. https://github.com/tc39/proposal-error-cause
This commit is contained in:
Linus Groh 2021-06-11 20:40:08 +01:00
parent 8d77a3297a
commit 862ba64037
11 changed files with 130 additions and 42 deletions

View file

@ -10,15 +10,9 @@
namespace JS {
AggregateError* AggregateError::create(GlobalObject& global_object, String const& message, Vector<Value> const& errors)
AggregateError* AggregateError::create(GlobalObject& global_object)
{
auto& vm = global_object.vm();
auto* error = global_object.heap().allocate<AggregateError>(global_object, *global_object.aggregate_error_prototype());
u8 attr = Attribute::Writable | Attribute::Configurable;
if (!message.is_null())
error->define_property(vm.names.message, js_string(vm, message), attr);
error->define_property(vm.names.errors, Array::create_from(global_object, errors), attr);
return error;
return global_object.heap().allocate<AggregateError>(global_object, *global_object.aggregate_error_prototype());
}
AggregateError::AggregateError(Object& prototype)