Skip to content

Commit

Permalink
should never happen, but lets handle gracefully anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
codabrink committed Feb 3, 2025
1 parent 1f0a2f8 commit b75faed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion xmtp_mls/src/storage/encrypted_store/db_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ where
<Db as XmtpDb>::TransactionManager::begin_transaction(&mut *write)?;

if self.in_transaction.swap(true, Ordering::SeqCst) {
panic!("Already in transaction.");
return Err(StorageError::AlreadyInTransaction);
}

Ok(TransactionGuard {
Expand Down
2 changes: 2 additions & 0 deletions xmtp_mls/src/storage/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub enum StorageError {
Duplicate(DuplicateItem),
#[error(transparent)]
OpenMlsStorage(#[from] SqlKeyStoreError),
#[error("Connection is already marked as in transaction")]
AlreadyInTransaction,
#[error("Transaction was intentionally rolled back")]
IntentionalRollback,
}
Expand Down

0 comments on commit b75faed

Please sign in to comment.