bitwarden_pam/error.rs
1use bitwarden_core::{ApiError, MissingFieldError};
2use bitwarden_error::bitwarden_error;
3use thiserror::Error;
4
5/// Errors returned from the PAM leasing clients
6/// ([`AccessRequestsClient`](crate::AccessRequestsClient)
7/// and [`LeasesClient`](crate::LeasesClient)).
8///
9/// Access requests and leases are two sides of the same lifecycle - activating a request mints a
10/// lease, and extending a lease returns the updated request - so both clients share one error type
11/// rather than each defining a near-identical one.
12#[bitwarden_error(flat)]
13#[derive(Debug, Error)]
14pub enum LeasingError {
15 /// The server response was missing a field required to build the requested type.
16 #[error(transparent)]
17 MissingField(#[from] MissingFieldError),
18 /// The server returned an access-request decider kind this SDK version does not recognize.
19 #[error("The server returned an unrecognized access-request decider kind")]
20 UnrecognizedDeciderKind,
21 /// A date field in the server response could not be parsed.
22 #[error(transparent)]
23 Chrono(#[from] chrono::ParseError),
24 /// A network or (de)serialization error occurred while calling the server.
25 #[error(transparent)]
26 Api(#[from] ApiError),
27}