diff --git a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h index 4d57ab2c84..a34395d0c6 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h +++ b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h @@ -296,6 +296,7 @@ M(TypedArrayInvalidBufferLength, "Invalid buffer length for {}: must be a multiple of {}, got {}") \ M(TypedArrayInvalidByteOffset, "Invalid byte offset for {}: must be a multiple of {}, got {}") \ M(TypedArrayInvalidCopy, "Copy between arrays of different content types ({} and {}) is prohibited") \ + M(TypedArrayInvalidIntegerIndex, "Invalid integer index: {}") \ M(TypedArrayInvalidTargetOffset, "Invalid target offset: must be {}") \ M(TypedArrayOutOfRangeByteOffset, "Typed array byte offset {} is out of range for buffer with length {}") \ M(TypedArrayOutOfRangeByteOffsetOrLength, "Typed array range {}:{} is out of range for buffer with length {}") \ diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp index eea9610e4a..a7307920c0 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp @@ -1680,7 +1680,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::with) // 9. If ! IsValidIntegerIndex(O, 𝔽(actualIndex)) is false, throw a RangeError exception. if (!is_valid_integer_index(*typed_array, CanonicalIndex(CanonicalIndex::Type::Index, actual_index))) - return vm.throw_completion(ErrorType::InvalidIndex); + return vm.throw_completion(ErrorType::TypedArrayInvalidIntegerIndex, actual_index); // 10. Let A be ? TypedArrayCreateSameType(O, « 𝔽(len) »). MarkedVector arguments(vm.heap());