diff options
author | Linus Groh <mail@linusgroh.de> | 2021-10-20 17:56:22 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-10-20 18:46:24 +0100 |
commit | ca09f20dcfc61db3ffdf7ecf63c1b104490b9332 (patch) | |
tree | 1f2ad4c88a806d8d17c95fe05e79f0d3662c5c5f /Userland | |
parent | 8feae8102594a68a5ec23c6f1b24630255cc88fd (diff) | |
download | serenity-ca09f20dcfc61db3ffdf7ecf63c1b104490b9332.zip |
LibJS: Add ErrorType for IterableToListOfType value type mismatch
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/ErrorTypes.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h index b1da75690d..bd91b3d827 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h +++ b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h @@ -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") \ diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 5f85fdc877..157315bf27 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -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; |