@@ -9,7 +9,7 @@ pub enum Error {
9
9
#[ error( "AssertionNotFound {reason}" ) ]
10
10
AssertionNotFound { reason : String } ,
11
11
#[ error( "Decoding {reason}" ) ]
12
- Decoding { reason : String } ,
12
+ Decoding { reason : String } ,
13
13
#[ error( "Encoding {reason}" ) ]
14
14
Encoding { reason : String } ,
15
15
#[ error( "FileNotFound{reason}" ) ]
@@ -45,10 +45,12 @@ impl Error {
45
45
use c2pa:: Error :: * ;
46
46
let err_str = err. to_string ( ) ;
47
47
match err {
48
- c2pa:: Error :: AssertionMissing { url } => Self :: AssertionNotFound { reason : "" . to_string ( ) } ,
48
+ c2pa:: Error :: AssertionMissing { url } => Self :: AssertionNotFound {
49
+ reason : "" . to_string ( ) ,
50
+ } ,
49
51
AssertionInvalidRedaction
50
52
| AssertionRedactionNotFound
51
- | AssertionUnsupportedVersion => Self :: Assertion { reason : err_str} ,
53
+ | AssertionUnsupportedVersion => Self :: Assertion { reason : err_str } ,
52
54
ClaimAlreadySigned
53
55
| ClaimUnsigned
54
56
| ClaimMissingSignatureBox
@@ -59,11 +61,11 @@ impl Error {
59
61
| ClaimSelfRedact
60
62
| ClaimDisallowedRedaction
61
63
| 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 } ,
67
69
CoseSignatureAlgorithmNotSupported
68
70
| CoseMissingKey
69
71
| CoseX5ChainMissing
@@ -78,19 +80,25 @@ impl Error {
78
80
| CoseTimeStampGeneration
79
81
| CoseTimeStampAuthority
80
82
| 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
+ }
91
99
#[ cfg( feature = "add_thumbnails" ) ]
92
100
ImageError => Self :: ImageError ( err_str) ,
93
- _ => Self :: Other { reason : err_str} ,
101
+ _ => Self :: Other { reason : err_str } ,
94
102
}
95
103
}
96
104
}
@@ -111,7 +119,8 @@ impl From<c2pa::Error> for Error {
111
119
112
120
impl From < std:: io:: Error > for Error {
113
121
fn from ( err : std:: io:: Error ) -> Self {
114
- Self :: Io { reason : err. to_string ( ) }
122
+ Self :: Io {
123
+ reason : err. to_string ( ) ,
124
+ }
115
125
}
116
126
}
117
-
0 commit comments