identity_credential/sd_jwt_vc/
error.rs1use serde_json::Value;
5use thiserror::Error;
6
7#[derive(Error, Debug)]
10pub enum Error {
11 #[error("missing required claim \"{0}\"")]
13 MissingClaim(&'static str),
14 #[error("claim \"{0}\" cannot be disclosed")]
16 DisclosedClaim(&'static str),
17 #[error("invalid value for claim \"{name}\"; expected value of type {expected}, but {found} was found")]
19 InvalidClaimValue {
20 name: &'static str,
22 expected: &'static str,
24 found: Value,
26 },
27 #[error(transparent)]
29 SdJwt(#[from] sd_jwt_payload_rework::Error),
30 #[error("invalid \"typ\" value; expected \"vc+sd-jwt\" (or a superset) but found \"{0}\"")]
32 InvalidJoseType(String),
33 #[error("failed to resolve \"{input}\"")]
35 Resolution {
36 input: String,
38 #[source]
40 source: super::resolver::Error,
41 },
42 #[error("invalid Issuer Metadata: {0}")]
44 InvalidIssuerMetadata(#[source] anyhow::Error),
45 #[error("invalid Type Metadata: {0}")]
47 InvalidTypeMetadata(#[source] anyhow::Error),
48 #[error("credential validation failed: {0}")]
50 Validation(#[source] anyhow::Error),
51 #[error("verification failed: {0}")]
53 Verification(#[source] anyhow::Error),
54}
55
56pub type Result<T> = std::result::Result<T, Error>;