Bitmessage/PyBitmessage — pull request #399 by grant-olson (2013-08-11 21:03:06+00:00)
Title: Convert 'API Error' to raise APIError()

This pull request:

* Creates an APIError exception class that accepts both an error number and error string, allowing for the future possibility to internationalize actual error text.

* Changes the logic in the API so that errors are raised, and success values are returned. (This happens internally. The XMLRPC still returns the same error strings)

* Catches unhandled exceptions and return them as new `API Error 21 - Unexpected API Failure`. This previously caused the API to hang as documented in Bitmessage/PyBitmessage#397

* Adds an internal _decode method that raises an explicit error `API Error 22: Decode Error` when invalid or hex or base64 text is submitted in an API request