identity_credential/revocation/
error.rs

1// Copyright 2020-2023 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4/// A result type designed for `RevocationBitmap2022` handling.
5pub type RevocationResult<T> = std::result::Result<T, RevocationError>;
6
7/// Errors occurring when creating or extracting a Service of type `RevocationBitmap2022`
8#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]
9#[non_exhaustive]
10pub enum RevocationError {
11  #[error("revocation bitmap could not be deserialized or decompressed")]
12  /// Indicates that the bitmap could not be reconstructed.
13  BitmapDecodingError(#[source] std::io::Error),
14  #[error("revocation bitmap could not be serialized or compressed")]
15  /// Indicates that the bitmap could not be encoded.
16  BitmapEncodingError(#[source] std::io::Error),
17  /// This variant is typically used to indicate invalid conversions between `Services`, `ServiceEndpoints` and
18  /// `RevocationBitmaps`.
19  #[error("{0}")]
20  InvalidService(&'static str),
21  /// Indicates a failure to decode a bitmap from a base64 string representation.
22  #[error("unable to decode base64 string: `{0}`")]
23  Base64DecodingError(String, #[source] identity_core::error::Error),
24  #[error("could not parse url")]
25  #[non_exhaustive]
26  /// Indicates a failure to construct a URL when attempting to construct a `ServiceEndpoint`.
27  UrlConstructionError(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
28}