mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
LibWeb: Use specific error classes when throwing exceptions
Generally: - interpreter.throw_exception<JS::Error>("TypeError", "Message"); + interpreter.throw_exception<JS::TypeError>("Message");
This commit is contained in:
parent
ad230e8839
commit
62d0fa5af8
3 changed files with 6 additions and 6 deletions
|
@ -78,7 +78,7 @@ static Window* impl_from(JS::Interpreter& interpreter)
|
|||
return nullptr;
|
||||
}
|
||||
if (StringView("WindowObject") != this_object->class_name()) {
|
||||
interpreter.throw_exception<JS::Error>("TypeError", "That's not a WindowObject, bro.");
|
||||
interpreter.throw_exception<JS::TypeError>("That's not a WindowObject, bro.");
|
||||
return nullptr;
|
||||
}
|
||||
return &static_cast<WindowObject*>(this_object)->impl();
|
||||
|
@ -108,7 +108,7 @@ JS::Value WindowObject::set_interval(JS::Interpreter& interpreter)
|
|||
if (!callback_object)
|
||||
return {};
|
||||
if (!callback_object->is_function())
|
||||
return interpreter.throw_exception<JS::Error>("TypeError", "Not a function");
|
||||
return interpreter.throw_exception<JS::TypeError>("Not a function");
|
||||
impl->set_interval(*static_cast<JS::Function*>(callback_object), arguments[1].to_i32());
|
||||
return JS::js_undefined();
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ JS::Value WindowObject::set_timeout(JS::Interpreter& interpreter)
|
|||
if (!callback_object)
|
||||
return {};
|
||||
if (!callback_object->is_function())
|
||||
return interpreter.throw_exception<JS::Error>("TypeError", "Not a function");
|
||||
return interpreter.throw_exception<JS::TypeError>("Not a function");
|
||||
|
||||
i32 interval = 0;
|
||||
if (interpreter.argument_count() >= 2)
|
||||
|
@ -147,7 +147,7 @@ JS::Value WindowObject::request_animation_frame(JS::Interpreter& interpreter)
|
|||
if (!callback_object)
|
||||
return {};
|
||||
if (!callback_object->is_function())
|
||||
return interpreter.throw_exception<JS::Error>("TypeError", "Not a function");
|
||||
return interpreter.throw_exception<JS::TypeError>("Not a function");
|
||||
return JS::Value(impl->request_animation_frame(*static_cast<JS::Function*>(callback_object)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue