Skip to content

Commit b0492d4

Browse files
authored
Merge pull request #739 from the-anonymous009/error_kind
Make error kind public
2 parents df0b7e2 + 71cb6ee commit b0492d4

File tree

1 file changed

+5
-0
lines changed
  • tokio-postgres/src/error

1 file changed

+5
-0
lines changed

tokio-postgres/src/error/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,11 @@ impl Error {
421421
self.source().and_then(|e| e.downcast_ref::<DbError>())
422422
}
423423

424+
/// Determines if the error was associated with closed connection.
425+
pub fn is_closed(&self) -> bool {
426+
self.0.kind == Kind::Closed
427+
}
428+
424429
/// Returns the SQLSTATE error code associated with the error.
425430
///
426431
/// This is a convenience method that downcasts the cause to a `DbError` and returns its code.

0 commit comments

Comments
 (0)