Skip to content

Commit 56082f9

Browse files
committed
chore(sdk): forward "database is busy" errors to sentry
1 parent c847451 commit 56082f9

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

crates/matrix-sdk-sqlite/src/error.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,22 @@ macro_rules! impl_from {
119119
};
120120
}
121121

122-
impl_from!(rusqlite::Error => Error::Sqlite);
122+
impl From<rusqlite::Error> for Error {
123+
fn from(error: rusqlite::Error) -> Self {
124+
if let rusqlite::Error::SqliteFailure(ffi_error, message) = &error {
125+
if ffi_error.code == rusqlite::ErrorCode::DatabaseBusy {
126+
// Report to sentry.
127+
tracing::error!(
128+
sentry = true,
129+
sqlite_message = message,
130+
"observed database busy error"
131+
);
132+
}
133+
}
134+
Error::Sqlite(error)
135+
}
136+
}
137+
123138
impl_from!(PoolError => Error::Pool);
124139
impl_from!(rmp_serde::encode::Error => Error::Encode);
125140
impl_from!(rmp_serde::decode::Error => Error::Decode);

0 commit comments

Comments
 (0)