Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improove Exception handling #10

Open
ricco386 opened this issue Aug 31, 2017 · 0 comments
Open

Improove Exception handling #10

ricco386 opened this issue Aug 31, 2017 · 0 comments

Comments

@ricco386
Copy link

Install the library and try to execute dodgy script in the directory where are no Python files. Instead of the stack trace, I would imagine an error message or at least empty dict...

<mock-chroot> sh-4.4# dodgy
Traceback (most recent call last):
  File "/usr/bin/dodgy", line 4, in <module>
    dodgy.run.run()
  File "/usr/lib/python2.7/site-packages/dodgy/run.py", line 56, in run
    warnings = run_checks(os.getcwd())
  File "/usr/lib/python2.7/site-packages/dodgy/run.py", line 44, in run_checks
    for msg_parts in check_file(filepath):
  File "/usr/lib/python2.7/site-packages/dodgy/checks.py", line 72, in check_file
    return check_file_contents(to_check.read())
  File "/usr/lib64/python2.7/codecs.py", line 686, in read
    return self.reader.read(size)
  File "/usr/lib64/python2.7/codecs.py", line 492, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte

<mock-chroot> sh-4.4# dodgy-3.6 
Traceback (most recent call last):
  File "/usr/bin/dodgy-3.6", line 4, in <module>
    dodgy.run.run()
  File "/usr/lib/python3.6/site-packages/dodgy/run.py", line 56, in run
    warnings = run_checks(os.getcwd())
  File "/usr/lib/python3.6/site-packages/dodgy/run.py", line 44, in run_checks
    for msg_parts in check_file(filepath):
  File "/usr/lib/python3.6/site-packages/dodgy/checks.py", line 72, in check_file
    return check_file_contents(to_check.read())
  File "/usr/lib64/python3.6/codecs.py", line 698, in read
    return self.reader.read(size)
  File "/usr/lib64/python3.6/codecs.py", line 501, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant