openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
16 lines (15 loc) • 606 B
JavaScript
import { o as racePromiseWithAbortSignal } from "./src-BPmQBLJp.mjs";
import "./abort-signal-D4Q6SEw7.mjs";
//#region src/gateway/worker-environments/node-worker-abort.ts
function raceNodeWorkerOperation(e, t, n = {
aborted: "node worker operation aborted",
failed: "node worker operation failed"
}) {
if (!t) return e;
const abortError = () => t.reason instanceof Error ? t.reason : new Error(n.aborted);
return racePromiseWithAbortSignal(e, t, abortError).catch((e) => {
throw e instanceof Error ? e : new Error(n.failed ?? String(e));
});
}
//#endregion
export { raceNodeWorkerOperation as t };