File tree Expand file tree Collapse file tree 2 files changed +9
-19
lines changed Expand file tree Collapse file tree 2 files changed +9
-19
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ readme = "README.md"
11
11
12
12
13
13
[dependencies ]
14
- anyhow = " 1.0.31"
15
14
byteorder = " 1.3.2"
16
15
pastey = " 0.1.0"
17
16
thiserror = " 2"
Original file line number Diff line number Diff line change 1
1
// SPDX-License-Identifier: MIT
2
2
3
- use anyhow:: anyhow;
4
3
use thiserror:: Error ;
5
4
6
5
#[ derive( Debug , Error ) ]
7
- # [ error ( "Encode error occurred: {inner}" ) ]
8
- pub struct EncodeError {
9
- inner : anyhow :: Error ,
6
+ pub enum EncodeError {
7
+ # [ error ( transparent ) ]
8
+ Other ( # [ from ] Box < dyn std :: error :: Error > ) ,
10
9
}
11
10
12
- impl From < & ' static str > for EncodeError {
13
- fn from ( msg : & ' static str ) -> Self {
14
- EncodeError {
15
- inner : anyhow ! ( msg) ,
16
- }
11
+ impl From < & str > for EncodeError {
12
+ fn from ( msg : & str ) -> Self {
13
+ let error: Box < dyn std:: error:: Error > = msg. to_string ( ) . into ( ) ;
14
+ EncodeError :: Other ( error)
17
15
}
18
16
}
19
17
20
18
impl From < String > for EncodeError {
21
19
fn from ( msg : String ) -> Self {
22
- EncodeError {
23
- inner : anyhow ! ( msg) ,
24
- }
25
- }
26
- }
27
-
28
- impl From < anyhow:: Error > for EncodeError {
29
- fn from ( inner : anyhow:: Error ) -> EncodeError {
30
- EncodeError { inner }
20
+ let error: Box < dyn std:: error:: Error > = msg. into ( ) ;
21
+ EncodeError :: Other ( error)
31
22
}
32
23
}
33
24
You can’t perform that action at this time.
0 commit comments