mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: handle unsupported language errors gracefully in read_file tool (#3359)
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
This commit is contained in:
parent
2cf6eb192d
commit
a911e78d77
1 changed files with 15 additions and 1 deletions
|
|
@ -164,7 +164,21 @@ export async function readFileTool(
|
|||
|
||||
const res = await Promise.all([
|
||||
maxReadFileLine > 0 ? readLines(absolutePath, maxReadFileLine - 1, 0) : "",
|
||||
parseSourceCodeDefinitionsForFile(absolutePath, cline.rooIgnoreController),
|
||||
(async () => {
|
||||
try {
|
||||
return await parseSourceCodeDefinitionsForFile(absolutePath, cline.rooIgnoreController)
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.message.startsWith("Unsupported language:")) {
|
||||
console.warn(`[read_file] Warning: ${error.message}`)
|
||||
return undefined
|
||||
} else {
|
||||
console.error(
|
||||
`[read_file] Unhandled error: ${error instanceof Error ? error.message : String(error)}`,
|
||||
)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
})(),
|
||||
])
|
||||
|
||||
content = res[0].length > 0 ? addLineNumbers(res[0]) : ""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue