status
The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs.
IMPORTANT: Backward compatibility notes:
To ensure any pair of senders and receivers continues to correctly signal and interpret erroneous situations, the senders and receivers MUST follow these rules:
Old senders and receivers that are not aware of
code
field will continue using thedeprecated_code
field to signal and interpret erroneous situation.New senders, which are aware of the
code
field MUST set both thedeprecated_code
andcode
fields according to the following rules:if code==STATUS_CODE_UNSET then
deprecated_code
MUST be set to DEPRECATED_STATUS_CODE_OK.if code==STATUS_CODE_OK then
deprecated_code
MUST be set to DEPRECATED_STATUS_CODE_OK.if code==STATUS_CODE_ERROR then
deprecated_code
MUST be set to DEPRECATED_STATUS_CODE_UNKNOWN_ERROR.These rules allow old receivers to correctly interpret data received from new senders.
New receivers MUST look at both the
code
anddeprecated_code
fields in order to interpret the overall status:If code==STATUS_CODE_UNSET then the value of
deprecated_code
is the carrier of the overall status according to these rules:if deprecated_code==DEPRECATED_STATUS_CODE_OK then the receiver MUST interpret
the overall status to be STATUS_CODE_UNSET.
if deprecated_code!=DEPRECATED_STATUS_CODE_OK then the receiver MUST interpret
the overall status to be STATUS_CODE_ERROR.If code!=STATUS_CODE_UNSET then the value of
deprecated_code
MUST be ignored, thecode
field is the sole carrier of the status.These rules allow new receivers to correctly interpret data received from old senders.
Functions
error(message)
Returns an error status code, with user defined error messsage
ok()
Returns a success status code