Skip to content

Commit

Permalink
Merge 5cb5cd1 into 1add881
Browse files Browse the repository at this point in the history
  • Loading branch information
xD3CODER committed Oct 19, 2023
2 parents 1add881 + 5cb5cd1 commit b86da23
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions gremlin-client/src/error.rs
Expand Up @@ -47,10 +47,20 @@ impl From<mobc::Error<GremlinError>> for GremlinError {
fn from(e: mobc::Error<GremlinError>) -> 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<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 b86da23

Please sign in to comment.