mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
Merge pull request #2857 from titusz/improve-read-errors
refactor: Reorder exception handling in file reading method
This commit is contained in:
commit
939cb7958a
1 changed files with 4 additions and 4 deletions
|
@ -345,10 +345,6 @@ class InputOutput:
|
|||
try:
|
||||
with open(str(filename), "r", encoding=self.encoding) as f:
|
||||
return f.read()
|
||||
except OSError as err:
|
||||
if not silent:
|
||||
self.tool_error(f"{filename}: unable to read: {err}")
|
||||
return
|
||||
except FileNotFoundError:
|
||||
if not silent:
|
||||
self.tool_error(f"{filename}: file not found error")
|
||||
|
@ -357,6 +353,10 @@ class InputOutput:
|
|||
if not silent:
|
||||
self.tool_error(f"{filename}: is a directory")
|
||||
return
|
||||
except OSError as err:
|
||||
if not silent:
|
||||
self.tool_error(f"{filename}: unable to read: {err}")
|
||||
return
|
||||
except UnicodeError as e:
|
||||
if not silent:
|
||||
self.tool_error(f"{filename}: {e}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue