11use crate :: { dialog:: DialogId , transaction:: key:: TransactionKey , transport:: SipAddr } ;
2- use std:: env:: VarError ;
32use thiserror:: Error as ThisError ;
4- use wasm_bindgen:: prelude:: * ;
53
64#[ derive( Debug , ThisError ) ]
75pub enum Error {
@@ -21,44 +19,23 @@ pub enum Error {
2119 EndpointError ( String ) ,
2220
2321 #[ error( "Dialog error: {0}: {1}" ) ]
24- DialogError ( String , DialogId ) ,
22+ DialogError ( String , DialogId , rsip :: StatusCode ) ,
2523
2624 #[ error( "I/O error: {0}" ) ]
2725 IoError ( #[ from] std:: io:: Error ) ,
2826
29- #[ error( "Format error: {0}" ) ]
30- FormatError ( #[ from] std:: fmt:: Error ) ,
31-
32- #[ error( "Environment variable error: {0}" ) ]
33- VarError ( #[ from] VarError ) ,
34-
3527 #[ error( "Address parse error: {0}" ) ]
3628 AddrParseError ( #[ from] std:: net:: AddrParseError ) ,
3729
38- #[ error( "TLS error: {0}" ) ]
39- TlsError ( #[ from] tokio_rustls:: rustls:: Error ) ,
40-
4130 #[ error( "WebSocket error: {0}" ) ]
4231 WebSocketError ( #[ from] tokio_tungstenite:: tungstenite:: Error ) ,
4332
44- #[ error( "Channel send error: {0}" ) ]
45- ChannelSendError ( String ) ,
46-
47- #[ error( "Broadcast receive error: {0}" ) ]
48- BroadcastRecvError ( #[ from] tokio:: sync:: broadcast:: error:: RecvError ) ,
49-
5033 #[ error( "Error: {0}" ) ]
5134 Error ( String ) ,
5235}
5336
54- impl From < Error > for JsValue {
55- fn from ( e : Error ) -> Self {
56- e. to_string ( ) . into ( )
57- }
58- }
59-
6037impl < T > From < tokio:: sync:: mpsc:: error:: SendError < T > > for Error {
6138 fn from ( e : tokio:: sync:: mpsc:: error:: SendError < T > ) -> Self {
62- Error :: ChannelSendError ( e. to_string ( ) )
39+ Error :: Error ( e. to_string ( ) )
6340 }
6441}
0 commit comments