spotify/snakebite — pull request #85 by Julian (2014-09-10 21:02:43+00:00)
Title: Don't swallow tracebacks when commands fail.

This propagates tracebacks when commands fail.

The first command I ran was `snakebite ls hdfs://somenamenode`, which before this change produced:

```
Traceback (most recent call last):
File "bin/snakebite", line 38, in
SnakebiteCli()
File "bin/snakebite", line 29, in __init__
clparser.execute()
File "/Users/Julian/Development/snakebite/snakebite/commandlineparser.py", line 452, in execute
exitError(e)
File "/Users/Julian/Development/snakebite/snakebite/commandlineparser.py", line 54, in exitError
raise error
IndexError: string index out of range
```

which now produces the slightly more helpful:

```
Traceback (most recent call last):
File "bin/snakebite", line 38, in
SnakebiteCli()
File "bin/snakebite", line 29, in __init__
clparser.execute()
File "/Users/Julian/Development/snakebite/snakebite/commandlineparser.py", line 453, in execute
exitError(sys.exc_info())
File "/Users/Julian/Development/snakebite/snakebite/commandlineparser.py", line 451, in execute
return Commands.methods[self.cmd]['method'](self)
File "/Users/Julian/Development/snakebite/snakebite/commandlineparser.py", line 483, in ls
for line in self._listing():
File "/Users/Julian/Development/snakebite/snakebite/commandlineparser.py", line 504, in _listing
summary=self.args.summary):
File "/Users/Julian/Development/snakebite/snakebite/formatter.py", line 91, in format_listing
node = listing.next()
File "/Users/Julian/Development/snakebite/snakebite/client.py", line 1323, in wrapped
yield results.next()
File "/Users/Julian/Development/snakebite/snakebite/client.py", line 139, in ls
recurse=recurse):
File "/Users/Julian/Development/snakebite/snakebite/client.py", line 1078, in _find_items
fileinfo = self._get_file_info(path)
File "/Users/Julian/Development/snakebite/snakebite/client.py", line 1208, in _get_file_info
return self.service.getFileInfo(request)
File "/Users/Julian/Development/snakebite/snakebite/service.py", line 35, in
rpc = lambda request, service=self, method=method.name: service.call(service_stub_class.__dict__[method], request)
File "/Users/Julian/Development/snakebite/snakebite/service.py", line 41, in call
return method(self.service, controller, request)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/protobuf/service_reflection.py", line 267, in
self._StubMethod(inst, method, rpc_controller, request, callback))
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/protobuf/service_reflection.py", line 284, in _StubMethod
method_descriptor.output_type._concrete_class, callback)
File "/Users/Julian/Development/snakebite/snakebite/channel.py", line 414, in CallMethod
return self.parse_response(byte_stream, response_class)
File "/Users/Julian/Development/snakebite/snakebite/channel.py", line 367, in parse_response
(header_len, header_bytes) = get_delimited_message_bytes(byte_stream)
File "/Users/Julian/Development/snakebite/snakebite/channel.py", line 88, in get_delimited_message_bytes
(length, pos) = decoder._DecodeVarint32(byte_stream.read(nr), 0)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/protobuf/internal/decoder.py", line 116, in DecodeVarint
b = local_ord(buffer[pos])
IndexError: string index out of range
```

which at least lets me know what the `IndexError` is in reference to.