(context post by Gavin Andresen)

2 messages BitcoinTalk Gavin Andresen, Satoshi Nakamoto September 6, 2010 — September 6, 2010
Gavin Andresen September 6, 2010 Source · Permalink

Speak now about this change or forever hold your peace… Satoshi will be including this functionality in the next version of Bitcoin (0.3.12).

If you use the JSON-RPC api, you should check your error-condition-handling code; again, the changes are that the error member will be an Object (with ‘code’ and ‘message’ fields) instead of a String, and the HTTP status code may be 404 instead of 500 for method-not-found.

Satoshi Nakamoto September 6, 2010 Source · Permalink

This is in SVN rev 147.

This is more standard, and although json-rpc 1.0 didn’t specify the format of error objects, it did specify that they would be objects not strings or other values, so we needed to change this to be correct.  The code/message members have become standard in later json-rpc specs.

If you have code that checks the error and expects a string, you’ll need to change it.  When there is an error, the error member is now an object not a string.

Also in SVN rev 147:

  • The command line json-rpc returns the error code as its exit code.  Exit codes can only be 0-255 on unix, so it’s abs(code)%256.
  • The “backupwallet ” command that was discussed in another thread.  It locks the wallet and copies it, so you can be sure you get a correct copy.