diff options
| author | joshualitt <[email protected]> | 2025-08-21 14:40:18 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-21 21:40:18 +0000 |
| commit | ec41b8db8e714867ea354c29c07f009cd837ac23 (patch) | |
| tree | 4bb01ac90a25d6d82cfc005d68aae336be192744 /packages/core/src/tools/glob.ts | |
| parent | 299bf58309a0950ac81ae051b02ec64463ebd153 (diff) | |
feat(core): Annotate remaining error paths in tools with type. (#6699)
Diffstat (limited to 'packages/core/src/tools/glob.ts')
| -rw-r--r-- | packages/core/src/tools/glob.ts | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/packages/core/src/tools/glob.ts b/packages/core/src/tools/glob.ts index 60186758..2bd26fbd 100644 --- a/packages/core/src/tools/glob.ts +++ b/packages/core/src/tools/glob.ts @@ -16,6 +16,7 @@ import { } from './tools.js'; import { shortenPath, makeRelative } from '../utils/paths.js'; import { Config } from '../config/config.js'; +import { ToolErrorType } from './tool-error.js'; // Subset of 'Path' interface provided by 'glob' that we can implement for testing export interface GlobPath { @@ -115,9 +116,14 @@ class GlobToolInvocation extends BaseToolInvocation< this.params.path, ); if (!workspaceContext.isPathWithinWorkspace(searchDirAbsolute)) { + const rawError = `Error: Path "${this.params.path}" is not within any workspace directory`; return { - llmContent: `Error: Path "${this.params.path}" is not within any workspace directory`, + llmContent: rawError, returnDisplay: `Path is not within workspace`, + error: { + message: rawError, + type: ToolErrorType.PATH_NOT_IN_WORKSPACE, + }, }; } searchDirectories = [searchDirAbsolute]; @@ -234,9 +240,14 @@ class GlobToolInvocation extends BaseToolInvocation< const errorMessage = error instanceof Error ? error.message : String(error); console.error(`GlobLogic execute Error: ${errorMessage}`, error); + const rawError = `Error during glob search operation: ${errorMessage}`; return { - llmContent: `Error during glob search operation: ${errorMessage}`, + llmContent: rawError, returnDisplay: `Error: An unexpected error occurred.`, + error: { + message: rawError, + type: ToolErrorType.GLOB_EXECUTION_ERROR, + }, }; } } |
