Enum hedwig::publish::GooglePubSubError[][src]

#[non_exhaustive]
pub enum GooglePubSubError {
Show 14 variants GetAuthToken(Arc<Error>), PostMessages(Arc<Error>), ConstructRequestUri(Arc<InvalidUri>), ConstructRequest(Arc<Error>), ResponseStatus(Option<Arc<PubSubPublishError>>, StatusCode), ResponseParse(Arc<Error>), ResponseBodyReceive(Arc<Error>), MessageTooManyHeaders, MessageHeaderKeysTooLarge, MessageHeaderKeysReserved(Arc<str>), MessageHeaderValuesTooLarge, MessageDataTooLong, MessageTimestampTooOld(SystemTimeError), SerializeMessageData(Arc<Error>),
}
This is supported on crate features publish and google only.
Expand description

Error messages that occur when publishing to Google PubSub.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
GetAuthToken(Arc<Error>)

Could not get authentication token.

Tuple Fields of GetAuthToken

0: Arc<Error>
PostMessages(Arc<Error>)

Could not POST the request with messages.

Tuple Fields of PostMessages

0: Arc<Error>
ConstructRequestUri(Arc<InvalidUri>)

Could not construct the request URI.

Tuple Fields of ConstructRequestUri

0: Arc<InvalidUri>
ConstructRequest(Arc<Error>)

Could not construct the request.

Tuple Fields of ConstructRequest

0: Arc<Error>

Publish request failed with a bad HTTP status code.

Tuple Fields of ResponseStatus

0: Option<Arc<PubSubPublishError>>1: StatusCode
ResponseParse(Arc<Error>)

Could not parse the response body.

Tuple Fields of ResponseParse

0: Arc<Error>
ResponseBodyReceive(Arc<Error>)

Could not receive the response body.

Tuple Fields of ResponseBodyReceive

0: Arc<Error>
MessageTooManyHeaders

Message contains too many headers.

MessageHeaderKeysTooLarge

Message contains a header key that’s too large.

MessageHeaderKeysReserved(Arc<str>)

Message contains a header with {0} key which is reserved.

Tuple Fields of MessageHeaderKeysReserved

0: Arc<str>
MessageHeaderValuesTooLarge

Message contains a header value that’s too large.

MessageDataTooLong

Encoded message data is too long.

MessageTimestampTooOld(SystemTimeError)

Message timestamp is too far in the past.

Tuple Fields of MessageTimestampTooOld

0: SystemTimeError
SerializeMessageData(Arc<Error>)

Could not serialize message data.

Tuple Fields of SerializeMessageData

0: Arc<Error>

Implementations

Can this error be considered recoverable.

Some examples of transient errors include errors such as failure to make a network request or authenticate with the API endpoint.

In these instances there is a good chance that retrying publishing of a message may succeed.

Examples

This function is useful when deciding whether to re-queue message for publishing.

use futures_util::stream::StreamExt;

let publisher: GooglePubSubPublisher<hyper::client::HttpConnector> = unimplemented!();
let mut batch = hedwig::publish::PublishBatch::new();
// add messages
let mut stream = batch.publish(&publisher);
let mut next_batch = hedwig::publish::PublishBatch::new();
async {
    while let Some(result) = stream.next().await {
        match result {
            (Ok(id), _, msg) => {
                println!("message {} published successfully: {:?}", msg.uuid(), id);
            }
            (Err(e), topic, msg) if e.is_transient() => {
                // Retry
                next_batch.push(topic, msg);
            }
            (Err(e), _, msg) => {
                eprintln!("failed to publish {}: {}", msg.uuid(), e);
            }
        }
    }
};

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more