mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-24 18:48:37 +00:00
* refactor: consolidate throwIfAborted in outbound module - Create abort.ts with shared throwIfAborted helper - Update deliver.ts, message-action-runner.ts, outbound-send-service.ts * fix: handle context overflow in isCompactionFailureError without requiring colon
16 lines
404 B
TypeScript
16 lines
404 B
TypeScript
/**
|
|
* Utility for checking AbortSignal state and throwing a standard AbortError.
|
|
*/
|
|
|
|
/**
|
|
* Throws an AbortError if the given signal has been aborted.
|
|
* Use at async checkpoints to support cancellation.
|
|
*/
|
|
export function throwIfAborted(abortSignal?: AbortSignal): void {
|
|
if (abortSignal?.aborted) {
|
|
const err = new Error("Operation aborted");
|
|
err.name = "AbortError";
|
|
throw err;
|
|
}
|
|
}
|