This repository was archived by the owner on Aug 27, 2025. It is now read-only.
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"
1111
1212
1313[dependencies ]
14- anyhow = " 1.0.31"
1514byteorder = " 1.3.2"
1615pastey = " 0.1.0"
1716thiserror = " 2"
Original file line number Diff line number Diff line change 11// SPDX-License-Identifier: MIT
22
3- use anyhow:: anyhow;
43use thiserror:: Error ;
54
65#[ 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 > ) ,
109}
1110
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)
1715 }
1816}
1917
2018impl From < String > for EncodeError {
2119 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)
3122 }
3223}
3324
You can’t perform that action at this time.
0 commit comments