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
sourceimpl Error for FcmError
impl Error for FcmError
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
impl StructuralPartialEq for FcmError
Auto Trait Implementations
impl RefUnwindSafe for FcmError
impl Send for FcmError
impl Sync for FcmError
impl Unpin for FcmError
impl UnwindSafe for FcmError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more