mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 01:29:17 +00:00
LibWeb/WebIDL: Throw correct error when converting integers
When an integer doesn't fit within the range of an integral type defined by WebIDL, the spec says to throw a `TypeError`, not a `RangeError`.
This commit is contained in:
parent
4e7d3026d2
commit
3be7e88903
Notes:
github-actions[bot]
2024-08-18 21:36:08 +00:00
Author: https://github.com/dzfrias
Commit: 3be7e88903
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1105
Reviewed-by: https://github.com/alimpfard
2 changed files with 2 additions and 2 deletions
|
@ -384,7 +384,7 @@ JS::ThrowCompletionOr<T> convert_to_int(JS::VM& vm, JS::Value value, EnforceRang
|
|||
|
||||
// 3. If x < lowerBound or x > upperBound, then throw a TypeError.
|
||||
if (x < lower_bound || x > upper_bound)
|
||||
return vm.throw_completion<JS::RangeError>(MUST(String::formatted("Number '{}' is outside of allowed range of {} to {}", x, lower_bound, upper_bound)));
|
||||
return vm.throw_completion<JS::TypeError>(MUST(String::formatted("Number '{}' is outside of allowed range of {} to {}", x, lower_bound, upper_bound)));
|
||||
|
||||
// 4. Return x.
|
||||
return x;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue