mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
refactor: handle file read errors in linter
This commit is contained in:
parent
d23f816353
commit
8d4d7af7d0
1 changed files with 5 additions and 1 deletions
|
@ -76,7 +76,11 @@ class Linter:
|
|||
|
||||
def lint(self, fname, cmd=None):
|
||||
rel_fname = self.get_rel_fname(fname)
|
||||
code = Path(fname).read_text(self.encoding)
|
||||
try:
|
||||
code = Path(fname).read_text(encoding=self.encoding, errors='replace')
|
||||
except Exception as e:
|
||||
print(f"Error reading file {fname}: {str(e)}")
|
||||
return
|
||||
|
||||
if cmd:
|
||||
cmd = cmd.strip()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue