diff --git a/gremlin-client/src/error.rs b/gremlin-client/src/error.rs index f762847e..068676d6 100644 --- a/gremlin-client/src/error.rs +++ b/gremlin-client/src/error.rs @@ -54,3 +54,17 @@ impl From> for GremlinError { } } } + +#[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) + } +}