File tree 2 files changed +27
-24
lines changed
2 files changed +27
-24
lines changed Original file line number Diff line number Diff line change
1
+ use thiserror:: Error ;
2
+ use tokio:: task:: JoinError ;
3
+ use tokio_tungstenite:: tungstenite;
4
+
5
+ pub type Result < T > = std:: result:: Result < T , AriError > ;
6
+
7
+ #[ derive( Debug , Error ) ]
8
+ pub enum AriError {
9
+ #[ error( "URL parsing error" ) ]
10
+ UrlParseError ( #[ from] url:: ParseError ) ,
11
+ #[ error( "WebSocket error" ) ]
12
+ TungsteniteError ( #[ from] tungstenite:: Error ) ,
13
+ #[ error( "HTTP Request error" ) ]
14
+ ReqwestError ( #[ from] reqwest:: Error ) ,
15
+ #[ error( "Join Error" ) ]
16
+ JoinError ( #[ from] JoinError ) ,
17
+ #[ error( "Unknown error occurred: {0}" ) ]
18
+ Unknown ( String ) ,
19
+ }
20
+
21
+ impl From < tungstenite:: error:: UrlError > for AriError {
22
+ fn from ( err : tungstenite:: error:: UrlError ) -> Self {
23
+ AriError :: TungsteniteError ( err. into ( ) )
24
+ }
25
+ }
Original file line number Diff line number Diff line change @@ -4,9 +4,6 @@ use channel::{
4
4
} ;
5
5
use device:: DeviceStateChanged ;
6
6
use serde:: { Deserialize , Serialize } ;
7
- use thiserror:: Error ;
8
- use tokio:: task:: JoinError ;
9
- use tokio_tungstenite:: tungstenite;
10
7
11
8
pub mod bridge;
12
9
pub mod channel;
@@ -17,27 +14,8 @@ pub mod recording;
17
14
pub mod rtp_statistics;
18
15
pub mod variable;
19
16
20
- pub type Result < T > = std:: result:: Result < T , AriError > ;
21
-
22
- #[ derive( Debug , Error ) ]
23
- pub enum AriError {
24
- #[ error( "URL parsing error" ) ]
25
- UrlParseError ( #[ from] url:: ParseError ) ,
26
- #[ error( "WebSocket error" ) ]
27
- TungsteniteError ( #[ from] tungstenite:: Error ) ,
28
- #[ error( "HTTP Request error" ) ]
29
- ReqwestError ( #[ from] reqwest:: Error ) ,
30
- #[ error( "Join Error" ) ]
31
- JoinError ( #[ from] JoinError ) ,
32
- #[ error( "Unknown error occurred: {0}" ) ]
33
- Unknown ( String ) ,
34
- }
35
-
36
- impl From < tungstenite:: error:: UrlError > for AriError {
37
- fn from ( err : tungstenite:: error:: UrlError ) -> Self {
38
- AriError :: TungsteniteError ( err. into ( ) )
39
- }
40
- }
17
+ mod error;
18
+ pub use error:: { AriError , Result } ;
41
19
42
20
#[ derive( Serialize , Deserialize , Debug ) ]
43
21
#[ serde( tag = "type" ) ]
You can’t perform that action at this time.
0 commit comments