File tree Expand file tree Collapse file tree 3 files changed +11
-27
lines changed Expand file tree Collapse file tree 3 files changed +11
-27
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ edition = "2021"
9
9
serde_json = " 1.0"
10
10
serde = { version = " 1.0" , features = [" derive" ] }
11
11
svix-bridge-types = { path = " ../svix-bridge-types" }
12
+ thiserror = " 1.0.61"
12
13
tokio = { version = " 1" , features = [" full" ] }
13
14
tokio-executor-trait = " 2.1"
14
15
tokio-reactor-trait = " 1.1"
Original file line number Diff line number Diff line change 1
1
pub use omniqueue:: QueueError ;
2
2
use svix_bridge_types:: svix;
3
+ use thiserror:: Error ;
3
4
5
+ #[ derive( Debug , Error ) ]
4
6
pub enum Error {
5
- Json ( serde_json:: Error ) ,
6
- Queue ( QueueError ) ,
7
- Svix ( svix:: error:: Error ) ,
7
+ #[ error( "json error: {0}" ) ]
8
+ Json ( #[ from] serde_json:: Error ) ,
9
+ #[ error( "queue error: {0}" ) ]
10
+ Queue ( #[ from] QueueError ) ,
11
+ #[ error( "svix API error: {0}" ) ]
12
+ Svix ( #[ from] svix:: error:: Error ) ,
13
+ #[ error( "{0}" ) ]
8
14
Generic ( String ) ,
9
15
}
10
16
pub type Result < T > = std:: result:: Result < T , Error > ;
11
17
12
- impl From < svix:: error:: Error > for Error {
13
- fn from ( value : svix:: error:: Error ) -> Self {
14
- Error :: Svix ( value)
15
- }
16
- }
17
-
18
- impl From < serde_json:: Error > for Error {
19
- fn from ( value : serde_json:: Error ) -> Self {
20
- Error :: Json ( value)
21
- }
22
- }
23
-
24
- impl From < QueueError > for Error {
25
- fn from ( value : QueueError ) -> Self {
26
- Error :: Queue ( value)
27
- }
28
- }
29
-
30
- impl From < String > for Error {
31
- fn from ( value : String ) -> Self {
32
- Self :: Generic ( value)
33
- }
34
- }
35
-
36
18
impl From < Error > for std:: io:: Error {
37
19
fn from ( value : Error ) -> Self {
38
20
match value {
You can’t perform that action at this time.
0 commit comments