@@ -155,7 +155,7 @@ export async function readFileTool(
155155 }
156156 } catch ( error ) {
157157 const errorMessage = `Failed to parse read_file XML args: ${ error instanceof Error ? error . message : String ( error ) } `
158- await handleError ( "parsing read_file args" , new Error ( errorMessage ) )
158+ await handleError ( "parsing read_file args" , new Error ( errorMessage ) , t ( "tools:readFile.errors.parseError" ) )
159159 pushToolResult ( `<files><error>${ errorMessage } </error></files>` )
160160 return
161161 }
@@ -226,7 +226,11 @@ export async function readFileTool(
226226 error : errorMsg ,
227227 xmlContent : `<file><path>${ relPath } </path><error>Error reading file: ${ errorMsg } </error></file>` ,
228228 } )
229- await handleError ( `reading file ${ relPath } ` , new Error ( errorMsg ) )
229+ await handleError (
230+ `reading file ${ relPath } ` ,
231+ new Error ( errorMsg ) ,
232+ t ( "tools:readFile.errors.invalidLineRange" ) ,
233+ )
230234 hasRangeError = true
231235 break
232236 }
@@ -237,7 +241,11 @@ export async function readFileTool(
237241 error : errorMsg ,
238242 xmlContent : `<file><path>${ relPath } </path><error>Error reading file: ${ errorMsg } </error></file>` ,
239243 } )
240- await handleError ( `reading file ${ relPath } ` , new Error ( errorMsg ) )
244+ await handleError (
245+ `reading file ${ relPath } ` ,
246+ new Error ( errorMsg ) ,
247+ t ( "tools:readFile.errors.invalidLineRange" ) ,
248+ )
241249 hasRangeError = true
242250 break
243251 }
@@ -508,6 +516,7 @@ export async function readFileTool(
508516 await handleError (
509517 `reading image file ${ relPath } ` ,
510518 error instanceof Error ? error : new Error ( errorMsg ) ,
519+ t ( "tools:readFile.errors.imageReadError" ) ,
511520 )
512521 continue
513522 }
@@ -616,7 +625,11 @@ export async function readFileTool(
616625 error : `Error reading file: ${ errorMsg } ` ,
617626 xmlContent : `<file><path>${ relPath } </path><error>Error reading file: ${ errorMsg } </error></file>` ,
618627 } )
619- await handleError ( `reading file ${ relPath } ` , error instanceof Error ? error : new Error ( errorMsg ) )
628+ await handleError (
629+ `reading file ${ relPath } ` ,
630+ error instanceof Error ? error : new Error ( errorMsg ) ,
631+ t ( "tools:readFile.errors.fileReadError" ) ,
632+ )
620633 }
621634 }
622635
@@ -704,8 +717,11 @@ export async function readFileTool(
704717 xmlContent : `<file><path>${ relPath } </path><error>Error reading file: ${ errorMsg } </error></file>` ,
705718 } )
706719 }
707-
708- await handleError ( `reading file ${ relPath } ` , error instanceof Error ? error : new Error ( errorMsg ) )
720+ await handleError (
721+ `reading file ${ relPath } ` ,
722+ error instanceof Error ? error : new Error ( errorMsg ) ,
723+ t ( "tools:readFile.errors.fileReadError" ) ,
724+ )
709725
710726 // Generate final XML result from all file results
711727 const xmlResults = fileResults . filter ( ( result ) => result . xmlContent ) . map ( ( result ) => result . xmlContent )
0 commit comments