Commit a73d467
Improve RelaceEditTool error handling for file not found errors (#826)
## Description
This PR improves the error handling in the `RelaceEditTool` when a file
is not found. Instead of raising a `FileNotFoundError` exception, it now
returns a `RelaceEditObservation` with an error status and a helpful
message.
## Changes
- Modified the `relace_edit` function to return a
`RelaceEditObservation` with an error status when a file is not found
- Added a more descriptive error message that includes the full filepath
and suggests using the full filepath relative to the repository root
## Why
Previously, when a user provided an invalid filepath to the
`RelaceEditTool`, it would raise a `FileNotFoundError` exception that
wasn't properly passed back to the assistant as an observation. This
change ensures that file not found errors are handled consistently with
other errors and returned as observations, allowing the assistant to
handle them gracefully.
Fixes the issue where users would see errors like:
```
FileNotFoundError('File not found: codegen_agi.py')
```
instead of getting a helpful error message as part of the tool's
observation.
---------
Co-authored-by: codegen-bot <team+codegenbot@codegen.sh>
Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>1 parent 757c9e8 commit a73d467
1 file changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
| |||
0 commit comments