summaryrefslogtreecommitdiff
path: root/packages/core/src/tools/read-many-files.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/read-many-files.ts
parent299bf58309a0950ac81ae051b02ec64463ebd153 (diff)
feat(core): Annotate remaining error paths in tools with type. (#6699)
Diffstat (limited to 'packages/core/src/tools/read-many-files.ts')
-rw-r--r--packages/core/src/tools/read-many-files.ts15
1 files changed, 7 insertions, 8 deletions
diff --git a/packages/core/src/tools/read-many-files.ts b/packages/core/src/tools/read-many-files.ts
index b3568cad..06bc2212 100644
--- a/packages/core/src/tools/read-many-files.ts
+++ b/packages/core/src/tools/read-many-files.ts
@@ -29,6 +29,7 @@ import {
recordFileOperationMetric,
FileOperation,
} from '../telemetry/metrics.js';
+import { ToolErrorType } from './tool-error.js';
/**
* Parameters for the ReadManyFilesTool.
@@ -232,13 +233,6 @@ ${finalExclusionPatternsForDescription
: [...exclude];
const searchPatterns = [...inputPatterns, ...include];
- if (searchPatterns.length === 0) {
- return {
- llmContent: 'No search paths or include patterns provided.',
- returnDisplay: `## Information\n\nNo search paths or include patterns were specified. Nothing to read or concatenate.`,
- };
- }
-
try {
const allEntries = new Set<string>();
const workspaceDirs = this.config.getWorkspaceContext().getDirectories();
@@ -352,9 +346,14 @@ ${finalExclusionPatternsForDescription
});
}
} catch (error) {
+ const errorMessage = `Error during file search: ${getErrorMessage(error)}`;
return {
- llmContent: `Error during file search: ${getErrorMessage(error)}`,
+ llmContent: errorMessage,
returnDisplay: `## File Search Error\n\nAn error occurred while searching for files:\n\`\`\`\n${getErrorMessage(error)}\n\`\`\``,
+ error: {
+ message: errorMessage,
+ type: ToolErrorType.READ_MANY_FILES_SEARCH_ERROR,
+ },
};
}