As we were already at it, you should find online the fix for API error codes (as reported by toecutter).
Thank you, very glad to hear that!
I'm in the middle of implementing it right now, but I have some follow-up concerns.
In the API docs, it says the error response looks like this:
{
"error": true,
"code": "INVALID_ADDRESS",
"message": "Invalid Bitcoind address"
}
However, in reality, it looks like this:
{
"error": true,
"code": "INVALID_ADDRESS",
"message": "Api response not successful (400): Invalid Bitcoind address"
}
(So docs don't follow the code, or vice versa, which is already troublesome)
Now suppose I don't want to show the "Api response not successful (400): " part to the user. Should I now use regexps to cut it out? :( I guess I could just have my own map:
{
"INVALID_ADDRESS": "Invalid Bitcoind address",
"INSUFFICIENT_FUNDS": "Insufficient funds",
etc....
}
but that is sub-optimal, because what if Paytoshi adds new error codes in the future?
Secondly, suppose I still want to provide my own error messages (for example, for localization purposes), based on the "code" value. I can't, because the docs do not have the complete list. So I'm left poking it in the dark.
Here are my suggestions (feel free to recommend another course of action):
1. Update the docs!
2. Remove the "Api response not successful (%d): " part from the "message"
3. Alternatively, leave the "Api response not successful (%d): " part, but then "guarantee" (by explicitly stating that in docs) that this message format will not change in the future (so if we go the regexp route, it won't break under us).
Sorry in advance if that sounds pedantic, it's just I'm really uncomfortable implementing undocumented APIs.