identity_credential/revocation/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2020-2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

/// A result type designed for `RevocationBitmap2022` handling.
pub type RevocationResult<T> = std::result::Result<T, RevocationError>;

/// Errors occurring when creating or extracting a Service of type `RevocationBitmap2022`
#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]
#[non_exhaustive]
pub enum RevocationError {
  #[error("revocation bitmap could not be deserialized or decompressed")]
  /// Indicates that the bitmap could not be reconstructed.
  BitmapDecodingError(#[source] std::io::Error),
  #[error("revocation bitmap could not be serialized or compressed")]
  /// Indicates that the bitmap could not be encoded.
  BitmapEncodingError(#[source] std::io::Error),
  /// This variant is typically used to indicate invalid conversions between `Services`, `ServiceEndpoints` and
  /// `RevocationBitmaps`.
  #[error("{0}")]
  InvalidService(&'static str),
  /// Indicates a failure to decode a bitmap from a base64 string representation.
  #[error("unable to decode base64 string: `{0}`")]
  Base64DecodingError(String, #[source] identity_core::error::Error),
  #[error("could not parse url")]
  #[non_exhaustive]
  /// Indicates a failure to construct a URL when attempting to construct a `ServiceEndpoint`.
  UrlConstructionError(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
}