mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +00:00
LibJS: Throw InternalErrors instead of Errors on CallStackSizeExceeded
These seem more appropriate.
This commit is contained in:
parent
7341faceeb
commit
957f54d96f
6 changed files with 9 additions and 9 deletions
|
@ -6,16 +6,16 @@ test("infinite recursion", () => {
|
|||
try {
|
||||
infiniteRecursion();
|
||||
} catch (e) {
|
||||
expect(e).toBeInstanceOf(Error);
|
||||
expect(e.name).toBe("Error");
|
||||
expect(e).toBeInstanceOf(InternalError);
|
||||
expect(e.name).toBe("InternalError");
|
||||
expect(e.message).toBe("Call stack size limit exceeded");
|
||||
}
|
||||
|
||||
expect(() => {
|
||||
JSON.stringify({}, () => ({ foo: "bar" }));
|
||||
}).toThrowWithMessage(Error, "Call stack size limit exceeded");
|
||||
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
|
||||
|
||||
expect(() => {
|
||||
new Proxy({}, { get: (_, __, p) => p.foo }).foo;
|
||||
}).toThrowWithMessage(Error, "Call stack size limit exceeded");
|
||||
}).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue