1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:58:11 +00:00

LibJS: Add interpreter exception checks

This commit is contained in:
Matthew Olsson 2020-06-07 10:53:14 -07:00 committed by Andreas Kling
parent f306ddb78b
commit 4e33fbdb67
11 changed files with 137 additions and 36 deletions

View file

@ -79,6 +79,8 @@ Value StringConstructor::raw(Interpreter& interpreter)
return {};
auto raw = template_object->get("raw");
if (interpreter.exception())
return {};
if (raw.is_empty() || raw.is_undefined() || raw.is_null()) {
interpreter.throw_exception<TypeError>(String::format("Cannot convert property 'raw' to object from %s", raw.is_null() ? "null" : "undefined"));
return {};