From 1cadd66145fa54520effa2504555287b6007e597 Mon Sep 17 00:00:00 2001 From: Lucian Buzzo Date: Thu, 9 Jan 2025 13:45:08 +0000 Subject: [PATCH] fix: return error instead of panicking in release_savepoint --- quaint/src/connector/transaction.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/quaint/src/connector/transaction.rs b/quaint/src/connector/transaction.rs index a861748b2b5..616dfcadcb1 100644 --- a/quaint/src/connector/transaction.rs +++ b/quaint/src/connector/transaction.rs @@ -177,9 +177,9 @@ impl Transaction for DefaultTransaction<'_> { let depth_val = self.depth.load(Ordering::Relaxed); if depth_val == 0 { - panic!( - "No savepoint to release in transaction, make sure to call create_savepoint before release_savepoint" - ); + return Err(crate::Error::new( + "No savepoint to release in transaction, make sure to call create_savepoint before release_savepoint", + )); } // Perform the asynchronous operation without holding the lock