summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/web-fetch.ts
diff options
context:
space:
mode:
authorjoshualitt <[email protected]>2025-08-21 14:40:18 -0700
committerGitHub <[email protected]>2025-08-21 21:40:18 +0000
commitec41b8db8e714867ea354c29c07f009cd837ac23 (patch)
tree4bb01ac90a25d6d82cfc005d68aae336be192744 /packages/core/src/tools/web-fetch.ts
parent299bf58309a0950ac81ae051b02ec64463ebd153 (diff)
feat(core): Annotate remaining error paths in tools with type. (#6699)
Diffstat (limited to 'packages/core/src/tools/web-fetch.ts')
-rw-r--r--packages/core/src/tools/web-fetch.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/packages/core/src/tools/web-fetch.ts b/packages/core/src/tools/web-fetch.ts
index 26e59efc..dfefae3d 100644
--- a/packages/core/src/tools/web-fetch.ts
+++ b/packages/core/src/tools/web-fetch.ts
@@ -13,6 +13,7 @@ import {
ToolInvocation,
ToolResult,
} from './tools.js';
+import { ToolErrorType } from './tool-error.js';
import { getErrorMessage } from '../utils/errors.js';
import { ApprovalMode, Config } from '../config/config.js';
import { getResponseText } from '../utils/generateContentResponseUtilities.js';
@@ -73,12 +74,6 @@ class WebFetchToolInvocation extends BaseToolInvocation<
private async executeFallback(signal: AbortSignal): Promise<ToolResult> {
const urls = extractUrls(this.params.prompt);
- if (urls.length === 0) {
- return {
- llmContent: 'Error: No URL found in the prompt for fallback.',
- returnDisplay: 'Error: No URL found in the prompt for fallback.',
- };
- }
// For now, we only support one URL for fallback
let url = urls[0];
@@ -130,6 +125,10 @@ ${textContent}
return {
llmContent: `Error: ${errorMessage}`,
returnDisplay: `Error: ${errorMessage}`,
+ error: {
+ message: errorMessage,
+ type: ToolErrorType.WEB_FETCH_FALLBACK_FAILED,
+ },
};
}
}
@@ -300,6 +299,10 @@ ${sourceListFormatted.join('\n')}`;
return {
llmContent: `Error: ${errorMessage}`,
returnDisplay: `Error: ${errorMessage}`,
+ error: {
+ message: errorMessage,
+ type: ToolErrorType.WEB_FETCH_PROCESSING_ERROR,
+ },
};
}
}