decode error responses to a Python exceptions