From f699241e12a95316344e5cdca7571b3912dc7575 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 18 May 2024 17:38:26 -0700 Subject: [PATCH] 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: ": 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 `: 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 ``` --- aider/linter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aider/linter.py b/aider/linter.py index 1bd13e8cd..0f7962aae 100644 --- a/aider/linter.py +++ b/aider/linter.py @@ -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)