Skip to main content

bitwarden_pam/access_rules/
error.rs

1use bitwarden_core::{ApiError, MissingFieldError};
2use bitwarden_error::bitwarden_error;
3use thiserror::Error;
4
5use super::validate::AccessRuleValidationError;
6
7/// Errors returned from [`super::AccessRulesClient`] operations.
8#[bitwarden_error(flat)]
9#[derive(Debug, Error)]
10pub enum AccessRuleError {
11    /// The request failed local validation before being sent to the server.
12    #[error(transparent)]
13    Validation(#[from] AccessRuleValidationError),
14    /// The `conditions` field of a server response could not be interpreted.
15    #[error("Invalid conditions: {0}")]
16    InvalidConditions(String),
17    /// The server response was missing a field required to build the requested type.
18    #[error(transparent)]
19    MissingField(#[from] MissingFieldError),
20    /// A date field in the server response could not be parsed.
21    #[error(transparent)]
22    Chrono(#[from] chrono::ParseError),
23    /// A network or (de)serialization error occurred while calling the server.
24    #[error(transparent)]
25    Api(#[from] ApiError),
26}