From 1e7629578e904714b918d2b4dcc5af566778f5fa Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Wed, 4 Dec 2024 16:14:44 -0800 Subject: [PATCH] LibWeb: Include code point in error message for ByteString conversion --- Libraries/LibWeb/WebIDL/AbstractOperations.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibWeb/WebIDL/AbstractOperations.cpp b/Libraries/LibWeb/WebIDL/AbstractOperations.cpp index 5476c6cc7905..7b2ddc14603d 100644 --- a/Libraries/LibWeb/WebIDL/AbstractOperations.cpp +++ b/Libraries/LibWeb/WebIDL/AbstractOperations.cpp @@ -234,7 +234,7 @@ JS::ThrowCompletionOr to_byte_string(JS::VM& vm, JS::Value value) // 2. If the value of any element of x is greater than 255, then throw a TypeError. for (auto character : x.code_points()) { if (character > 0xFF) - return vm.throw_completion(JS::ErrorType::InvalidCodePoint); + return vm.throw_completion(MUST(String::formatted("Invalid code point {}, must be integers in the range 0-255 (U+0000-U+00FF).", String::from_code_point(character)))); } // 3. Return an IDL ByteString value whose length is the length of x, and where the value of each element is the value of the corresponding element of x.