mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 16:30:22 +00:00
fix: use relayAbort helper for addEventListener to preserve AbortError reason
This commit is contained in:
committed by
Peter Steinberger
parent
5ac8d1d2bb
commit
7ec60d6449
@@ -1,4 +1,5 @@
|
||||
import type { AnyAgentTool } from "./pi-tools.types.js";
|
||||
import { bindAbortRelay } from "../utils/fetch-timeout.js";
|
||||
|
||||
function throwAbortError(): never {
|
||||
const err = new Error("Aborted");
|
||||
@@ -36,7 +37,7 @@ function combineAbortSignals(a?: AbortSignal, b?: AbortSignal): AbortSignal | un
|
||||
}
|
||||
|
||||
const controller = new AbortController();
|
||||
const onAbort = controller.abort.bind(controller);
|
||||
const onAbort = bindAbortRelay(controller);
|
||||
a?.addEventListener("abort", onAbort, { once: true });
|
||||
b?.addEventListener("abort", onAbort, { once: true });
|
||||
return controller.signal;
|
||||
|
||||
Reference in New Issue
Block a user