joshmarshall / jsonrpclib

A Python JSON-RPC over HTTP that mirrors xmlrpclib syntax.
Other
447 stars 144 forks source link

Add access to error.data #21

Open tuomassalo opened 11 years ago

tuomassalo commented 11 years ago

When a JSON-RPC call fails, the server may send additional information in error.data. This change allows access to that data. Now you can do something like:

s = jsonrpclib.Server('http://...')
try:
  s.my.method.call(...)
except AppError as e:
  # access e.data() here
except:
  # protocol errors and other stuff go here, as earlier