mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 19:46:54 +00:00
handle file reading exceptions
This commit is contained in:
parent
31d9774748
commit
38bd34f828
2 changed files with 15 additions and 1 deletions
|
|
@ -42,6 +42,12 @@ def check_file_for_debug_statements(filename):
|
|||
print('\t' + traceback.format_exc().replace('\n', '\n\t'))
|
||||
print()
|
||||
return 1
|
||||
except Exception:
|
||||
print('{} - Caught exception while reading file'.format(filename))
|
||||
print()
|
||||
print('\t' + traceback.format_exc().replace('\n', '\n\t'))
|
||||
print()
|
||||
return 1
|
||||
visitor = ImportStatementParser()
|
||||
visitor.visit(ast_obj)
|
||||
if visitor.debug_import_statements:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue