Skip to content

Commit 427fc34

Browse files
author
hansolshin
committed
Make error kind public
1 parent 7da21e1 commit 427fc34

File tree

1 file changed

+6
-2
lines changed
  • tokio-postgres/src/error

1 file changed

+6
-2
lines changed

tokio-postgres/src/error/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ pub enum ErrorPosition {
336336
},
337337
}
338338

339-
#[derive(Debug, PartialEq)]
340-
enum Kind {
339+
#[derive(Debug, PartialEq, Clone)]
340+
pub enum Kind {
341341
Io,
342342
UnexpectedMessage,
343343
Tls,
@@ -428,6 +428,10 @@ impl Error {
428428
self.as_db_error().map(DbError::code)
429429
}
430430

431+
pub fn kind(&self) -> Kind {
432+
self.0.kind.clone()
433+
}
434+
431435
fn new(kind: Kind, cause: Option<Box<dyn error::Error + Sync + Send>>) -> Error {
432436
Error(Box::new(ErrorInner { kind, cause }))
433437
}

0 commit comments

Comments
 (0)