Browse Source

Upgraded error reporting in the PixelHub Protocol.

master
Starbeamrainbowlabs 4 years ago
parent
commit
f0ead36496
1 changed files with 20 additions and 1 deletions
  1. +20
    -1
      PixelHub Protocol.md

+ 20
- 1
PixelHub Protocol.md View File

@ -50,7 +50,20 @@ This is the basic structure of a PixelHub Protocol message. The labels are expla
- `byte` null - A single null byte (`0b00000000`). This signifiest he end o the message. Even though it's technically not needed because of the _Message Length_ included above, it's been added anyway to simplify initial parsing and message end detection.
### Error: When bots complain
This message doesn't have a body, but is a direct response to a message that the sending party recieved that it didn't like.
Error messages are in direct response to a message that the sending party recieved that it didn't like. The body is optional, but if specified, should contain the following:
```
+------------+------------+------------+------------+
| Byte 1 | Byte 2 | Byte 3 | Byte 4 |
+------------+------------+------------+------------+
| uint Error Code |
+---------------------------------------------------+
| char* Error Message |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
```
- `uint` Error Code - The code attached to the error message. Error codes are a positive integer. Numbers 1-10000 are reserved for the server. See the error code section at the end of this document.
- `char*` Error Message - Additional human-readable details about the error in question that has occurred. May be empty, especially if the server is complaining to the client, as the client probably won't have anything to do with it unless it's being debugged.
### HandshakeRequest: Beginning a handshake
@ -188,3 +201,9 @@ Type | Name | Description
Note that a status message isn't actually contained in this protocol. This is becaue it is rather awkward to respond to network messages in the middle of a movement, so it will always be something along the lines of 'idle'.
## Error Codes
It's highly likely that an error will occur sooner or later. In the PixelHub protocol, all errors have their own number, where no number is ever thrown in the same place in the code base twice, allowing for errors to be reliably traced back ot their source without a usable stack trace. The following caregories of error have been assigned:
- 0 - A general error. Please try not to use this if at all possible.
- 1-10,000 - Server errors.
- 10,001-20,000 - PixelBot errors.