Expand description
Errors and error details returned by Service RPCs.
The Google Cloud Client Libraries for Rust distinguishes between errors detected while trying to send a RPC (e.g. cannot open a connection), errors trying to receive a response (e.g. the connection is dropped before the full response), and errors returned by the service itself.
The types in this module represent detailed information returned by the Google Cloud services.
§Examples
use error::Error;
use error::rpc::Status;
fn handle_error(e: Error) {
if let Some(status) = e.status() {
println!("the service reported {status:?}")
}
}Structs§
- Status
- The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. Each Status message contains three pieces of data: error code, error message, and error details.
Enums§
- Code
- The canonical error codes for APIs.
Sometimes multiple error codes may apply. Services should return
the most specific error code that applies. For example, prefer
OUT_OF_RANGEoverFAILED_PRECONDITIONif both codes apply. Similarly preferNOT_FOUNDorALREADY_EXISTSoverFAILED_PRECONDITION. - Status
Details - The type of details associated with Status.