Merge pull request #739 from the-anonymous009/error_kind

Make error kind public
This commit is contained in:
Steven Fackler
2021-03-28 20:26:02 -04:00
committed by GitHub

View File

@@ -421,6 +421,11 @@ impl Error {
self.source().and_then(|e| e.downcast_ref::<DbError>())
}
/// Determines if the error was associated with closed connection.
pub fn is_closed(&self) -> bool {
self.0.kind == Kind::Closed
}
/// Returns the SQLSTATE error code associated with the error.
///
/// This is a convenience method that downcasts the cause to a `DbError` and returns its code.