From 5166e74799ad5d529748ad7ba2c2d674bcf8bfd4 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Tue, 11 Feb 2025 23:11:20 -0500 Subject: [PATCH] BaseLLM: don't disguise AbortError when rethrowing When we catch/log/rethrow AbortError, throw it as itself, rather than throw Error(e.message) so that outer callers can detect it by the exception name. --- core/llm/index.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/llm/index.ts b/core/llm/index.ts index cc7d7123c..de55528a9 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -460,11 +460,7 @@ export abstract class BaseLLM implements ILLM { throw new Error(message); } } - //if e instance of LLMError, rethrow - if (e instanceof LLMError) { - throw e; - } - throw new Error(e.message); + throw e; } }; return withExponentialBackoff(