SeattleTestbed / seash

Interactive vessel management tool
MIT License
0 stars 10 forks source link

Ensure readable errors are printed by seash, not tracebacks... #84

Open JustinCappos opened 9 years ago

JustinCappos commented 9 years ago

Right now, doing a few basic things wrong in seash results in tracebacks. It would be better to catch expected errors and print nicer error messages.

For example:

Justins-MacBook-Air:seattle_demokit justincappos$ python seash.py

Enabled modules: clearinghouse, factoids, geoip, modules, variables

!> loadkeys ../abc Traceback (most recent call last): File "seash.py", line 267, in command_loop File "/Users/justincappos/Downloads/seattle_demokit/seash_dictionary.py", line 2109, in command_dispatch File "/Users/justincappos/Downloads/seattle_demokit/command_callbacks.py", line 1534, in loadkeys_keyname File "/Users/justincappos/Downloads/seattle_demokit/rsa", line 719, in rsa_file_to_privatekey File "/Users/justincappos/Downloads/seattle_demokit/emulfile.py", line 179, in emulated_open File "/Users/justincappos/Downloads/seattle_demokit/emulfile.py", line 291, in init FileNotFoundError: Cannot openfile non-existent file "../abc.privatekey" without creating it! !>

dubdubdub@%all !> upload aksd Traceback (most recent call last): File "seash.py", line 267, in command_loop File "/Users/justincappos/Downloads/seattle_demokit/seash_dictionary.py", line 2109, in command_dispatch File "/Users/justincappos/Downloads/seattle_demokit/command_callbacks.py", line 1864, in upload_filename IOError: [Errno 2] No such file or directory: 'aksd' dubdubdub@%all !>

aaaaalbert commented 9 years ago

Proposed fix in 5b36d1f9b04e81a70135488d4ac088553476b2c9. You may try it out my branch like so,

git clone https://github.com/SeattleTestbed/seash.git -b beautify-error-messages

followed by the usual init/build steps.

Things I tested, with "NX" refering to a non-existant file:

loadpub NX
loadpub a_key

loadpriv NX
loadpriv a_key

loadkeys NX

# Next up, try loading a key pair with only one of the keys available
loadkeys only_pub
loadkeys only_priv

on %all
upload NX
run NX