aider: Change error message format to display the class name instead of the full type.

# Aider chat conversation:

USER:         res = f"{type(err)}: {err}\n" is producing: "<class 'IndentationError'>: unexpected indent (tmp.syntaxerror.py, line 4)" I want it to say "IndentationError: unexpected indent (tmp.syntaxerror.py, line 4)"

ASSISTANT: To change the error message format from `<class 'IndentationError'>: unexpected indent (tmp.syntaxerror.py, line 4)` to `IndentationError: unexpected indent (tmp.syntaxerror.py, line 4)`, we need to modify the line where the error message is being constructed.

Here is the *SEARCH/REPLACE* block:

aider/linter.py
```python
<<<<<<< SEARCH
        res = f"{type(err)}: {err}\n"
=======
        res = f"{type(err).__name__}: {err}\n"
>>>>>>> REPLACE
```
This commit is contained in:
Paul Gauthier 2024-05-18 17:38:26 -07:00
parent 30c9c4c319
commit f699241e12

View file

@ -78,7 +78,7 @@ def lint_pycompile(fname, code):
except Exception as err:
dump(dir(err))
dump(err.text)
res = f"{type(err)}: {err}\n"
res = f"{type(err).__name__}: {err}\n"
line_numbers = list(range(err.lineno - 1, err.end_lineno))
dump(line_numbers)