fix(mysql, postgres): update XDatabaseError for core changes to support downcast

This commit is contained in:
Ryan Leckey 2021-06-10 15:04:40 -07:00
parent ea50e6dccb
commit 2e9ba72b02
2 changed files with 30 additions and 0 deletions

View File

@ -45,6 +45,21 @@ impl DatabaseError for MySqlDatabaseError {
fn message(&self) -> &str {
&self.0.error_message
}
#[inline(always)]
fn as_error(&self) -> &(dyn StdError + Send + Sync + 'static) {
self
}
#[inline(always)]
fn as_error_mut(&mut self) -> &mut (dyn StdError + Send + Sync + 'static) {
self
}
#[inline(always)]
fn into_error(self: Box<Self>) -> Box<dyn StdError + Send + Sync + 'static> {
self
}
}
impl Display for MySqlDatabaseError {

View File

@ -25,6 +25,21 @@ impl DatabaseError for PgDatabaseError {
fn message(&self) -> &str {
self.0.message()
}
#[inline(always)]
fn as_error(&self) -> &(dyn StdError + Send + Sync + 'static) {
self
}
#[inline(always)]
fn as_error_mut(&mut self) -> &mut (dyn StdError + Send + Sync + 'static) {
self
}
#[inline(always)]
fn into_error(self: Box<Self>) -> Box<dyn StdError + Send + Sync + 'static> {
self
}
}
impl From<PgDatabaseError> for Error {