Skip to main content

Module rpc

Module rpc 

Source
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_RANGE over FAILED_PRECONDITION if both codes apply. Similarly prefer NOT_FOUND or ALREADY_EXISTS over FAILED_PRECONDITION.
StatusDetails
The type of details associated with Status.