Skip to main content

bitwarden_pam/approvals/
error.rs

1use bitwarden_core::ApiError;
2use bitwarden_error::bitwarden_error;
3use thiserror::Error;
4
5use crate::error::PamDecodeError;
6
7/// Errors returned from [`super::ApprovalsClient`] operations.
8///
9/// [`UnsubmittableVerdict`](Self::UnsubmittableVerdict) comes only from
10/// [`decide`](super::ApprovalsClient::decide).
11#[bitwarden_error(flat)]
12#[derive(Debug, Error)]
13pub enum ApprovalError {
14    /// A decision was submitted with
15    /// [`AccessDecisionVerdict::Unknown`](crate::AccessDecisionVerdict::Unknown), which is
16    /// read-only.
17    #[error("An access-request decision cannot be submitted with an unrecognized verdict")]
18    UnsubmittableVerdict,
19    /// A server response could not be decoded into the requested type.
20    #[error(transparent)]
21    Decode(#[from] PamDecodeError),
22    /// A network or (de)serialization error occurred while calling the server.
23    #[error(transparent)]
24    Api(#[from] ApiError),
25}