YUKI Hiroshi
null+****@clear*****
Wed Jan 29 13:24:06 JST 2014
YUKI Hiroshi 2014-01-29 13:24:06 +0900 (Wed, 29 Jan 2014) New Revision: 0ada0b3baf0f22cca8943ee51ce09f0886a9a176 https://github.com/droonga/droonga.org/commit/0ada0b3baf0f22cca8943ee51ce09f0886a9a176 Message: Add description about "errors" field of the envelope Modified files: reference/message/index.md Modified: reference/message/index.md (+42 -1) =================================================================== --- reference/message/index.md 2014-01-29 13:14:30 +0900 (af332c4) +++ reference/message/index.md 2014-01-29 13:24:06 +0900 (d13789e) @@ -82,7 +82,8 @@ The basic format of a response message is like following: "type" : "<Type of the message>", "inReplyTo" : "<ID of the related request message>", "statusCode" : <Status code>, - "body" : <Body of the message> + "body" : <Body of the message>, + "errors" : <Errors from databases> } ### `type` {#response-type} @@ -122,6 +123,15 @@ Abstract Value : Object, string, number, boolean, or `null`. +### `errors` {#response-errors} + +Abstract +: All errors from databases. + +Value +: Object. + +This information will appear only when the command is distributed to multiple databases (partitions/replications) and they returned errors. Otherwise, the response message will have no `errors` field. For more details, see [the "Error response" section](#error). ## Error response {#error} @@ -129,6 +139,37 @@ Some commands can return an error response. An error response has the `type` same to a regular response, but it has different `statusCode` and `body`. General type of the error is indicated by the `statusCode`, and details are reported as the `body`. +If a command is distributed to multiple databases (partitions/replications) and they return errors, then the response message will have an `error` field. All errors from all databases are stored to the field, like: + + { + "type" : "add.result", + "inReplyTo" : "...", + "statusCode" : 400, + "body" : { + "name": "UnknownTable", + "message": ... + }, + "errors" : { + "/path/to/the/database1" : { + "statusCode" : 400, + "body" : { + "name": "UnknownTable", + "message": ... + } + }, + "/path/to/the/database2" : { + "statusCode" : 400, + "body" : { + "name": "UnknownTable", + "message": ... + } + } + } + } + +In this case, one of all errors will be exported as the main message `body`, as a representative. + + ### Status codes of error responses {#error-status} Status codes of error responses are similar to HTTP's one. Possible values: -------------- next part -------------- HTML����������������������������...Download