fix: keep unhandled rejections safe
This commit is contained in:
parent
3b879fe524
commit
3a25a4fa99
@ -125,13 +125,16 @@ describe("installUnhandledRejectionHandler - fatal detection", () => {
|
|||||||
expect(consoleWarnSpy).toHaveBeenCalled();
|
expect(consoleWarnSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does NOT exit on generic errors without code", () => {
|
it("exits on generic errors without code", () => {
|
||||||
const genericErr = new Error("Something went wrong");
|
const genericErr = new Error("Something went wrong");
|
||||||
|
|
||||||
process.emit("unhandledRejection", genericErr, Promise.resolve());
|
process.emit("unhandledRejection", genericErr, Promise.resolve());
|
||||||
|
|
||||||
expect(exitCalls).toEqual([]);
|
expect(exitCalls).toEqual([1]);
|
||||||
expect(consoleWarnSpy).toHaveBeenCalled();
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
||||||
|
"[clawdbot] Unhandled promise rejection:",
|
||||||
|
expect.stringContaining("Something went wrong"),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does NOT exit on connection reset errors", () => {
|
it("does NOT exit on connection reset errors", () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user