Bitcointalk · HTTP status codes from the JSON-RPC api

中本聪,2010 年 9 月 6 日

SN-2683 已核对来源,附原文与上下文。

阅读语言
中文译文

这在 SVN rev 147 里。

如此更标准。虽然 json-rpc 1.0 并无规定错误对象的格式,然而它规定了错误务必是对象而不是字符串或其他值,因而我们得改过来才算正确。code/message 成员在后来的 json-rpc 规范里已然成为标准。

倘若你有检查 error 并期望字符串的代码,你需要改它。出错时,error 成员现在是对象而不是字符串。

SVN rev 147 里尚有: - 命令行 json-rpc 把错误码作为退出码返回。unix 上退出码只能是 0-255,因而是 abs(code)%256。 - 另一个帖子里讨论过的 "backupwallet " 命令。它会锁定钱包并拷贝,因而你能确定拿到的是正确的副本。

ORIGINAL · 英文原文
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 <destination>" command that was discussed in another thread.  It locks the wallet and copies it, so you can be sure you get a correct copy.
上下文
← 上一条 SN-2683 · 当前 下一条 → 在档案中查看完整主题串 →
来源
Bitcointalk 原始链接 ↗ 记录编号 SN-2683