mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 03:08:13 +00:00
LibJS: Add ErrorType for IterableToListOfType value type mismatch
This commit is contained in:
parent
8feae81025
commit
ca09f20dcf
2 changed files with 2 additions and 1 deletions
|
@ -56,6 +56,7 @@
|
|||
M(IterableNextBadReturn, "iterator.next() returned a non-object value") \
|
||||
M(IterableNextNotAFunction, "'next' property on returned object from Symbol.iterator method is not a function") \
|
||||
M(IterableReturnBadReturn, "iterator.return() returned a non-object value") \
|
||||
M(IterableToListOfTypeInvalidValue, "Cannot create typed list from iterable, invalid value {}") \
|
||||
M(JsonBigInt, "Cannot serialize BigInt value to JSON") \
|
||||
M(JsonCircular, "Cannot stringify circular object") \
|
||||
M(JsonMalformed, "Malformed JSON string") \
|
||||
|
|
|
@ -67,7 +67,7 @@ ThrowCompletionOr<MarkedValueList> iterable_to_list_of_type(GlobalObject& global
|
|||
// ii. If Type(nextValue) is not an element of elementTypes, then
|
||||
if (auto type = to_option_type(next_value); !type.has_value() || !element_types.contains_slow(*type)) {
|
||||
// 1. Let completion be ThrowCompletion(a newly created TypeError object).
|
||||
auto completion = vm.throw_completion<TypeError>(global_object, ErrorType::FixmeAddAnErrorString);
|
||||
auto completion = vm.throw_completion<TypeError>(global_object, ErrorType::IterableToListOfTypeInvalidValue, next_value.to_string_without_side_effects());
|
||||
// 2. Return ? IteratorClose(iteratorRecord, completion).
|
||||
iterator_close(*iterator_record);
|
||||
return completion;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue