diff --git a/gremlin-client/src/error.rs b/gremlin-client/src/error.rs index f762847..4d08dcd 100644 --- a/gremlin-client/src/error.rs +++ b/gremlin-client/src/error.rs @@ -47,10 +47,20 @@ impl From> for GremlinError { fn from(e: mobc::Error) -> GremlinError { match e { mobc::Error::Inner(e) => e, - mobc::Error::BadConn => { - GremlinError::Generic(String::from("Async pool bad connection")) - } + mobc::Error::BadConn => GremlinError::Generic(String::from("Async pool bad connection")), mobc::Error::Timeout => GremlinError::Generic(String::from("Async pool timeout")), } } } + +#[cfg(not(feature = "async_gremlin"))] +impl From for GremlinError { + fn from(e: tungstenite::error::Error) -> GremlinError { + let error = match e { + tungstenite::error::Error::AlreadyClosed => tungstenite::error::Error::AlreadyClosed, + tungstenite::error::Error::ConnectionClosed => tungstenite::error::Error::ConnectionClosed, + _ => return GremlinError::Generic(format!("Error from ws {}", e)), + }; + GremlinError::WebSocket(error) + } +}