diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h index 646c1eca3ed..7c776ad3083 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.h +++ b/Userland/Libraries/LibJS/Runtime/VM.h @@ -198,10 +198,16 @@ public: return JS::throw_completion(completion); } + template + Completion throw_completion(ErrorType type) + { + return throw_completion(String::from_utf8_without_validation(type.message().bytes())); + } + template Completion throw_completion(ErrorType type, Args&&... args) { - return throw_completion(ByteString::formatted(type.message(), forward(args)...)); + return throw_completion(MUST(String::formatted(type.message(), forward(args)...))); } Value get_new_target();