mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 15:30:39 +00:00
refactor(process): use dedicated CommandLaneClearedError in clearCommandLane
Replace bare `new Error("Command lane cleared")` with a dedicated
`CommandLaneClearedError` class so callers that fire-and-forget
enqueued tasks can catch this specific type and avoid surfacing
unhandled rejection warnings.
This commit is contained in:
committed by
Peter Steinberger
parent
a49dd83b14
commit
a5ccfa57a8
@@ -18,6 +18,7 @@ vi.mock("../logging/diagnostic.js", () => ({
|
||||
|
||||
import {
|
||||
clearCommandLane,
|
||||
CommandLaneClearedError,
|
||||
enqueueCommand,
|
||||
enqueueCommandInLane,
|
||||
getActiveTaskCount,
|
||||
@@ -218,7 +219,7 @@ describe("command queue", () => {
|
||||
expect(removed).toBe(1); // only the queued (not active) entry
|
||||
|
||||
// The queued promise should reject.
|
||||
await expect(second).rejects.toThrow("Command lane cleared");
|
||||
await expect(second).rejects.toBeInstanceOf(CommandLaneClearedError);
|
||||
|
||||
// Let the active task finish normally.
|
||||
resolve1();
|
||||
|
||||
Reference in New Issue
Block a user