@@ -9,7 +9,7 @@ pub enum Error {
99 #[ error( "AssertionNotFound {reason}" ) ]
1010 AssertionNotFound { reason : String } ,
1111 #[ error( "Decoding {reason}" ) ]
12- Decoding { reason : String } ,
12+ Decoding { reason : String } ,
1313 #[ error( "Encoding {reason}" ) ]
1414 Encoding { reason : String } ,
1515 #[ error( "FileNotFound{reason}" ) ]
@@ -45,10 +45,12 @@ impl Error {
4545 use c2pa:: Error :: * ;
4646 let err_str = err. to_string ( ) ;
4747 match err {
48- c2pa:: Error :: AssertionMissing { url } => Self :: AssertionNotFound { reason : "" . to_string ( ) } ,
48+ c2pa:: Error :: AssertionMissing { url } => Self :: AssertionNotFound {
49+ reason : "" . to_string ( ) ,
50+ } ,
4951 AssertionInvalidRedaction
5052 | AssertionRedactionNotFound
51- | AssertionUnsupportedVersion => Self :: Assertion { reason : err_str} ,
53+ | AssertionUnsupportedVersion => Self :: Assertion { reason : err_str } ,
5254 ClaimAlreadySigned
5355 | ClaimUnsigned
5456 | ClaimMissingSignatureBox
@@ -59,11 +61,11 @@ impl Error {
5961 | ClaimSelfRedact
6062 | ClaimDisallowedRedaction
6163 | UpdateManifestInvalid
62- | TooManyManifestStores => Self :: Manifest { reason : err_str} ,
63- ClaimMissing { label } => Self :: ManifestNotFound { reason : err_str} ,
64- AssertionDecoding ( _) | ClaimDecoding => Self :: Decoding { reason : err_str} ,
65- AssertionEncoding | XmlWriteError | ClaimEncoding => Self :: Encoding { reason : err_str} ,
66- InvalidCoseSignature { coset_error } => Self :: Signature { reason : err_str} ,
64+ | TooManyManifestStores => Self :: Manifest { reason : err_str } ,
65+ ClaimMissing { label } => Self :: ManifestNotFound { reason : err_str } ,
66+ AssertionDecoding ( _) | ClaimDecoding => Self :: Decoding { reason : err_str } ,
67+ AssertionEncoding | XmlWriteError | ClaimEncoding => Self :: Encoding { reason : err_str } ,
68+ InvalidCoseSignature { coset_error } => Self :: Signature { reason : err_str } ,
6769 CoseSignatureAlgorithmNotSupported
6870 | CoseMissingKey
6971 | CoseX5ChainMissing
@@ -78,19 +80,25 @@ impl Error {
7880 | CoseTimeStampGeneration
7981 | CoseTimeStampAuthority
8082 | CoseSigboxTooSmall
81- | InvalidEcdsaSignature => Self :: Signature { reason : err_str} ,
82- RemoteManifestFetch ( _) | RemoteManifestUrl ( _) => Self :: RemoteManifest { reason : err_str} ,
83- JumbfNotFound => Self :: ManifestNotFound { reason : err_str} ,
84- BadParam ( _) | MissingFeature ( _) => Self :: Other { reason : err_str} ,
85- IoError ( _) => Self :: Io { reason : err_str} ,
86- JsonError ( e) => Self :: Json { reason : err_str} ,
87- NotFound | ResourceNotFound ( _) | MissingDataBox => Self :: ResourceNotFound { reason : err_str} ,
88- FileNotFound ( _) => Self :: FileNotFound { reason : err_str} ,
89- UnsupportedType => Self :: NotSupported { reason : err_str} ,
90- ClaimVerification ( _) | InvalidClaim ( _) | JumbfParseError ( _) => Self :: Verify { reason : err_str} ,
83+ | InvalidEcdsaSignature => Self :: Signature { reason : err_str } ,
84+ RemoteManifestFetch ( _) | RemoteManifestUrl ( _) => {
85+ Self :: RemoteManifest { reason : err_str }
86+ }
87+ JumbfNotFound => Self :: ManifestNotFound { reason : err_str } ,
88+ BadParam ( _) | MissingFeature ( _) => Self :: Other { reason : err_str } ,
89+ IoError ( _) => Self :: Io { reason : err_str } ,
90+ JsonError ( e) => Self :: Json { reason : err_str } ,
91+ NotFound | ResourceNotFound ( _) | MissingDataBox => {
92+ Self :: ResourceNotFound { reason : err_str }
93+ }
94+ FileNotFound ( _) => Self :: FileNotFound { reason : err_str } ,
95+ UnsupportedType => Self :: NotSupported { reason : err_str } ,
96+ ClaimVerification ( _) | InvalidClaim ( _) | JumbfParseError ( _) => {
97+ Self :: Verify { reason : err_str }
98+ }
9199 #[ cfg( feature = "add_thumbnails" ) ]
92100 ImageError => Self :: ImageError ( err_str) ,
93- _ => Self :: Other { reason : err_str} ,
101+ _ => Self :: Other { reason : err_str } ,
94102 }
95103 }
96104}
@@ -111,7 +119,8 @@ impl From<c2pa::Error> for Error {
111119
112120impl From < std:: io:: Error > for Error {
113121 fn from ( err : std:: io:: Error ) -> Self {
114- Self :: Io { reason : err. to_string ( ) }
122+ Self :: Io {
123+ reason : err. to_string ( ) ,
124+ }
115125 }
116126}
117-
0 commit comments