mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 05:45:00 +00:00
refactor: Reorder exception handling in file reading method
This commit is contained in:
parent
ac26fc6d5f
commit
f28c912d5a
1 changed files with 4 additions and 4 deletions
|
@ -342,10 +342,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")
|
||||
|
@ -354,6 +350,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