Răsfoiți Sursa

fix(core): only swallow empty-content errors in chat, re-throw others

The bare catch block silently swallowed all exceptions including
network errors, auth failures, and timeouts. Now only catches
errors related to empty content (thinking model edge case) and
re-throws everything else so users see real error messages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fanghanjun 7 luni în urmă
părinte
comite
effcecc82d
1 a modificat fișierele cu 6 adăugiri și 2 ștergeri
  1. 6 2
      packages/core/src/interaction/project-tools.ts

+ 6 - 2
packages/core/src/interaction/project-tools.ts

@@ -588,9 +588,13 @@ export function createInteractionToolsFromDeps(
               onTextDelta: hooks?.onChatTextDelta,
             },
           );
-        } catch {
+        } catch (err) {
           // Thinking models (e.g. kimi-k2.5) may return empty content for simple inputs.
-          // Fall through to the built-in reply below.
+          // Only swallow empty-content errors; re-throw everything else (network, auth, etc.)
+          const msg = err instanceof Error ? err.message : "";
+          if (!msg.includes("empty") && !msg.includes("content")) {
+            throw err;
+          }
         }
       }