diff --git a/gremlin-client/src/connection.rs b/gremlin-client/src/connection.rs index 7b31462a..186d06ca 100644 --- a/gremlin-client/src/connection.rs +++ b/gremlin-client/src/connection.rs @@ -63,12 +63,11 @@ impl ConnectionStream { fn send(&mut self, payload: Vec) -> GremlinResult<()> { self.0 .write_message(Message::Binary(payload)) - .map_err(|e| Arc::new(e)) .map_err(GremlinError::from) } fn recv(&mut self) -> GremlinResult> { - match self.0.read_message().map_err(|e| Arc::new(e))? { + match self.0.read_message()? { Message::Binary(binary) => Ok(binary), _ => unimplemented!(), } diff --git a/gremlin-client/src/error.rs b/gremlin-client/src/error.rs index 58e01214..c88be829 100644 --- a/gremlin-client/src/error.rs +++ b/gremlin-client/src/error.rs @@ -14,7 +14,7 @@ pub enum GremlinError { Generic(String), #[error(transparent)] - WebSocket(tungstenite::error::Error), + WebSocket(#[from] tungstenite::Error), #[error(transparent)] Pool(#[from] r2d2::Error), @@ -56,17 +56,3 @@ 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) - } -}