SOME/IP
Return codes and errors
Problems with a REQUEST travel back in the Return Code of the answer: an ERROR message, or a RESPONSE when the server method itself reports the error. Some problems are caught before the server method even runs, and some can only show up as a timeout.
Two ways to report, one used here
SOME/IP knows two ways for a server to report a problem: the Return Code in the SOME/IP header of the answer, or an explicit error message that also carries details (exception data, such as a text) in its payload. The SOME/IP transformer of the Classic Platform uses the Return Code. The explicit error message with exception data is not supported by it.
The general return codes
| Return Code | Means |
|---|---|
E_OK | No problem. |
E_NOT_OK | A problem without further detail. |
E_UNKNOWN_SERVICE, E_UNKNOWN_METHOD | The Service ID, or the Method ID within a known service, is unknown. |
E_NOT_READY | Service and method are known, but the application behind them is not running. |
E_NOT_REACHABLE, E_TIMEOUT | Used only inside the client side; never sent on the wire. |
E_WRONG_PROTOCOL_VERSION, E_WRONG_INTERFACE_VERSION | The receiver does not support the Protocol Version or the Interface Version in the header. |
E_MALFORMED_MESSAGE | The payload cannot be deserialized. |
E_WRONG_MESSAGE_TYPE | Unexpected Message Type, for example a REQUEST_NO_RETURN for a method that needs a response. |
| E2E return codes | Problems found by end-to-end protection, if it is used. |
On top of these, a method can report its own errors: each ApplicationError (an error the method itself defines; it is listed for the ClientServerOperation). They travel in the same Return Code, moved into a range of values reserved for them so they never clash with the general return codes. The answer stays a normal RESPONSE: the Message Type is not changed to ERROR, and the payload still carries the outputs of the method.
Three rules that always hold
rule 1
Only REQUESTs get errors
No ERROR is ever sent back for an event or for a fire&forget call.
rule 2
No error for an error
A message that reports an error is never itself answered with an ERROR.
rule 3
Same IDs, empty payload
An ERROR copies the Message ID, the Request ID and the Interface Version from the REQUEST. Its payload is empty.
Where each problem is caught
SoAd reads only the first part of the SOME/IP header: the Message ID and the Length. It does not check versions; that is done by the SOME/IP transformer when it deserializes. If the transformer is set to an autonomous error reaction (the transformer sends the ERROR on its own, without the server SWC), the client gets the ERROR at once. (The R20-11 transformer specification writes Message Type RESPONSE into this answer; the protocol specification asks for ERROR, and this course follows the protocol specification.) And because the transformer of the client also checks each RESPONSE it receives, a client can likewise detect a broken RESPONSE.
Try it
Pick a problem and step through the story.
Things to notice. Three of the four problems end with an answer the client can read: an ERROR, or a RESPONSE for the ApplicationError. The unknown Method ID ends with silence and E_TIMEOUT, because nobody on the server side may answer it. In every answer, the Client ID and Session ID are those of the REQUEST.
Check yourself optional
New terms in this lesson
| Term | Meaning |
|---|---|
| Return Code | Header field: E_OK or the code of the problem |
ERROR | The Message Type of an answer that reports a problem |
E_NOT_OK, E_UNKNOWN_SERVICE, E_UNKNOWN_METHOD, E_NOT_READY, E_NOT_REACHABLE, E_TIMEOUT, E_WRONG_PROTOCOL_VERSION, E_WRONG_INTERFACE_VERSION, E_MALFORMED_MESSAGE, E_WRONG_MESSAGE_TYPE | The general return codes (table above) |
| ApplicationError | An error the method itself defines, carried in the Return Code of a RESPONSE |
| autonomous error reaction | The transformer, not the server SWC, sends the ERROR on its own |
Source: SOME/IP Protocol Specification, R20-11, section 4.2.6; SOME/IP Transformer, R20-11, sections 7.3.1, 7.3.4 and Appendix B; Socket Adaptor, R20-11, section 4.1.