1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibJS: Add generic InvalidLength error type

We have multiple array types now, so ArrayInvalidLength has been
replaced with a generic InvalidLength.

Also fixes a small issue in the Array constructor, it should throw
RangeError for invalid lengths, not TypeError.
This commit is contained in:
Linus Groh 2020-12-02 12:41:51 +00:00 committed by Andreas Kling
parent 5e08ae4e14
commit 6de4f1fcb3
4 changed files with 4 additions and 4 deletions

View file

@ -9,7 +9,7 @@ describe("errors", () => {
[-1, -100, -0.1, 0.1, 1.23, Infinity, -Infinity, NaN].forEach(value => {
expect(() => {
new Array(value);
}).toThrowWithMessage(TypeError, "Invalid array length");
}).toThrowWithMessage(RangeError, "Invalid array length");
});
});
});