Skip to content

Commit

Permalink
fix from tungstenite error (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
xD3CODER authored Oct 19, 2023
1 parent 1add881 commit b1c8902
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions gremlin-client/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,17 @@ impl From<mobc::Error<GremlinError>> for GremlinError {
}
}
}

#[cfg(not(feature = "async_gremlin"))]
impl From<tungstenite::error::Error> 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)
}
}

0 comments on commit b1c8902

Please sign in to comment.