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
codefield will continue using thedeprecated_codefield to signal and interpret erroneous situation.New senders, which are aware of the
codefield MUST set both thedeprecated_codeandcodefields according to the following rules:if code==STATUS_CODE_UNSET then
deprecated_codeMUST be set to DEPRECATED_STATUS_CODE_OK.if code==STATUS_CODE_OK then
deprecated_codeMUST be set to DEPRECATED_STATUS_CODE_OK.if code==STATUS_CODE_ERROR then
deprecated_codeMUST 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
codeanddeprecated_codefields in order to interpret the overall status:If code==STATUS_CODE_UNSET then the value of
deprecated_codeis 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_codeMUST be ignored, thecodefield 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