Bitcointalk

HTTP status codes from the JSON-RPC api

中本聪 · 2010 年 9 月 6 日

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

阅读语言

这在 SVN rev 147 里。

This is in SVN rev 147.

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

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.

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

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.

SVN rev 147 里尚有:

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

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.
上下文
来源
Bitcointalk 原始链接 ↗ 记录编号 SN-2683

阅读字号

选择适合你的字号,之后阅读会继续使用。