mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
LibJS: Convert to_string() to ThrowCompletionOr
Also update get_function_name() to use ThrowCompletionOr, but this is not a standard AO and should be refactored out of existence eventually.
This commit is contained in:
parent
5d38cf4973
commit
4d8912a92b
48 changed files with 171 additions and 415 deletions
|
@ -929,10 +929,7 @@ ThrowCompletionOr<String> get_substitution(GlobalObject& global_object, Utf16Vie
|
|||
auto& value = captures[*capture_position - 1];
|
||||
|
||||
if (!value.is_undefined()) {
|
||||
auto value_string = value.to_string(global_object);
|
||||
if (auto* exception = vm.exception())
|
||||
return throw_completion(exception->value());
|
||||
|
||||
auto value_string = TRY(value.to_string(global_object));
|
||||
result.append(value_string);
|
||||
}
|
||||
|
||||
|
@ -960,10 +957,7 @@ ThrowCompletionOr<String> get_substitution(GlobalObject& global_object, Utf16Vie
|
|||
auto capture = TRY(named_captures.as_object().get(group_name));
|
||||
|
||||
if (!capture.is_undefined()) {
|
||||
auto capture_string = capture.to_string(global_object);
|
||||
if (auto* exception = vm.exception())
|
||||
return throw_completion(exception->value());
|
||||
|
||||
auto capture_string = TRY(capture.to_string(global_object));
|
||||
result.append(capture_string);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue