Skip to main content

bitwarden_pam/access_requests/
error.rs

1use bitwarden_core::ApiError;
2use bitwarden_error::bitwarden_error;
3use thiserror::Error;
4
5use super::validate::AccessRequestWindowError;
6use crate::error::PamDecodeError;
7
8/// Errors returned from [`super::AccessRequestsClient`] operations.
9///
10/// [`Validation`](Self::Validation) comes only from
11/// [`request`](super::AccessRequestsClient::request).
12#[bitwarden_error(flat)]
13#[derive(Debug, Error)]
14pub enum AccessRequestError {
15    /// The request failed local validation before being sent to the server.
16    #[error(transparent)]
17    Validation(#[from] AccessRequestWindowError),
18    /// A server response could not be decoded into the requested type.
19    #[error(transparent)]
20    Decode(#[from] PamDecodeError),
21    /// A network or (de)serialization error occurred while calling the server.
22    #[error(transparent)]
23    Api(#[from] ApiError),
24}