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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2020-2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

/// Alias for a `Result` with the error type [`Error`].
pub type Result<T> = ::core::result::Result<T, Error>;

#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]
#[non_exhaustive]
pub enum Error {
  #[error("invalid input: {0}")]
  InvalidDisclosure(String),

  #[error("no hasher can be specified for the hashing algorithm {0}")]
  MissingHasher(String),

  #[error("data type is not expected: {0}")]
  DataTypeMismatch(String),

  #[error("claim {0} of disclosure already exists")]
  ClaimCollisionError(String),

  #[error("digest {0} appears multiple times")]
  DuplicateDigestError(String),

  #[error("array disclosure object contains keys other than `...`")]
  InvalidArrayDisclosureObject,

  #[error("invalid path: {0}")]
  InvalidPath(String),

  #[error("invalid input")]
  DeserializationError(String),

  #[error("{0}")]
  Unspecified(String),

  #[error("salt size must be greater than or equal to 16")]
  InvalidSaltSize,

  #[error("the validation ended with {0} unused disclosure(s)")]
  UnusedDisclosures(usize),
}