pub enum FcmError {
    Unauthorized,
    InvalidMessage(String),
    ServerError(Option<RetryAfter>),
}
Expand description

Fatal errors. Referred from Firebase documentation

Variants

Unauthorized

The sender account used to send a message couldn’t be authenticated. Possible causes are:

Authorization header missing or with invalid syntax in HTTP request.

  • The Firebase project that the specified server key belongs to is incorrect.
  • Legacy server keys only—the request originated from a server not whitelisted in the Server key IPs.

Check that the token you’re sending inside the Authentication header is the correct Server key associated with your project. See Checking the validity of a Server key for details. If you are using a legacy server key, you’re recommended to upgrade to a new key that has no IP restrictions.

InvalidMessage(String)

Check that the JSON message is properly formatted and contains valid fields (for instance, making sure the right data type is passed in).

ServerError(Option<RetryAfter>)

The server couldn’t process the request. Retry the same request, but you must:

  • Honor the RetryAfter value if included.
  • Implement exponential back-off in your retry mechanism. (e.g. if you waited one second before the first retry, wait at least two second before the next one, then 4 seconds and so on). If you’re sending multiple messages, delay each one independently by an additional random amount to avoid issuing a new request for all messages at the same time.

Senders that cause problems risk being blacklisted.

Trait Implementations

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

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

Provides type based access to context intended for error reports. Read more

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Returns the argument unchanged.

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

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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