mirror of
https://github.com/cadmium-im/cadmium-docs-legacy.git
synced 2024-11-22 10:22:22 +00:00
Add protocol error processing mechanism
This commit is contained in:
parent
ebd1a1b0a9
commit
bd405d725b
@ -26,3 +26,42 @@ to (EntityID) - message recipient
|
||||
ok (boolean) - operation success indicator (used to determine if errors was happened when processing request)
|
||||
payload (Map<K,V>) - message payload (used to store extra information in message, list of permissible fields in the payload are depends on "type" field)
|
||||
```
|
||||
|
||||
## Errors
|
||||
Mechanism of error processing included into protocol.
|
||||
Adds into type name `:error` postfix.
|
||||
|
||||
**Payload**:
|
||||
* `errCode: int` - error code (defined in extensions. Error code which defined in the specific extension MUST NOT overlap with other error codes)
|
||||
* `errText: String` - explanation of error in human-readable view
|
||||
* `errPayload: Map<K,V>` - advanced error information (fields defined in extensions)
|
||||
|
||||
**Example**:
|
||||
|
||||
*Request*:
|
||||
```json
|
||||
{
|
||||
"id": "abcd",
|
||||
"type": "incorrectMessageType",
|
||||
"from": "@juliet@cadmium.im",
|
||||
"to": "cadmium.im",
|
||||
"payload": {
|
||||
"test": "test"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
*Response*:
|
||||
```json
|
||||
{
|
||||
"id": "abcd",
|
||||
"type": "incorrectMessageType:error",
|
||||
"from": "cadmium.im",
|
||||
"to": "@juliet@cadmium.im",
|
||||
"payload": {
|
||||
"errCode": 0,
|
||||
"errText": "Incorrect type of message (type isn't implemented in the server)",
|
||||
"errPayload": {}
|
||||
}
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user