- Notifications
You must be signed in to change notification settings - Fork515
Make error::Kind public#1185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -337,15 +337,25 @@ pub enum ErrorPosition { | ||
}, | ||
} | ||
/// Error kind returned by the database. | ||
#[allow(missing_docs)] | ||
#[derive(Debug, PartialEq, Clone)] | ||
#[non_exhaustive] | ||
pub enum Kind { | ||
Io, | ||
UnexpectedMessage, | ||
Tls, | ||
ToSql(usize), | ||
FromSql(usize), | ||
Comment on lines 347 to 348 Member
| ||
/// A column was fetched from the row which wasn't returned by the database. | ||
/// This usually indicates the column wasn't included in the query. | ||
Column(String), | ||
/// The number of parameters expected by the query doesn't match the number | ||
/// of parameters passed when executing the prepared statement. | ||
Parameters { | ||
expected: usize, | ||
found: usize, | ||
}, | ||
Closed, | ||
Db, | ||
Parse, | ||
@@ -438,6 +448,11 @@ impl Error { | ||
self.as_db_error().map(DbError::code) | ||
} | ||
/// Returns the kind of error. | ||
pub fn kind(&self) -> &Kind { | ||
&self.0.kind | ||
} | ||
fn new(kind: Kind, cause: Option<Box<dyn error::Error + Sync + Send>>) -> Error { | ||
Error(Box::new(ErrorInner { kind, cause })) | ||
} | ||
Uh oh!
There was an error while loading.Please reload this page.