1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

LibJS: Convert to_i32() to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-10-17 23:33:35 +03:00
parent 20d990563c
commit f6a5ff7b00
11 changed files with 47 additions and 61 deletions

View file

@ -127,7 +127,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::from_code_point)
vm.throw_exception<RangeError>(global_object, ErrorType::InvalidCodePoint, next_code_point.to_string_without_side_effects());
return {};
}
auto code_point = next_code_point.to_i32(global_object);
auto code_point = TRY_OR_DISCARD(next_code_point.to_i32(global_object));
if (code_point < 0 || code_point > 0x10FFFF) {
vm.throw_exception<RangeError>(global_object, ErrorType::InvalidCodePoint, next_code_point.to_string_without_side_effects());
return {};