mongodb-labs / edda

A log visualizer for MongoDB - This Repository is NOT a supported MongoDB product
232 stars 28 forks source link

Handle file errors in a nicer way #64

Closed kchodorow closed 12 years ago

kchodorow commented 12 years ago

If someone gives an unreadable/non-existent file on the cmd line, right now it gives a stack trace:

Traceback (most recent call last):
  File "logl.py", line 252, in <module>
    main()
  File "logl.py", line 125, in main
    f = open(arg, 'r')
IOError: [Errno 2] No such file or directory: '~/sakjsdnf'

Should error out, probably, but with a nice message.

kchodorow commented 12 years ago
Error: Unable to read file ~/Downloads/1.log
Exiting
Traceback (most recent call last):
  File "logl.py", line 255, in <module>
    main()
  File "logl.py", line 136, in main
    for line in f:
UnboundLocalError: local variable 'f' referenced before assignment