| 2169 | } |
| 2170 | |
| 2171 | pub async fn rollback(&self, session_id: &Uuid) -> Result<(), PgSqliteError> { |
| 2172 | self.connection_manager.execute_with_session(session_id, |conn| { |
| 2173 | match conn.execute("ROLLBACK", []) { |
| 2174 | Ok(_) => Ok(()), |
| 2175 | Err(rusqlite::Error::SqliteFailure(_, Some(msg))) |
| 2176 | if msg.contains("cannot rollback - no transaction is active") => { |
| 2177 | // This is fine - no transaction was active |
| 2178 | debug!("ROLLBACK called with no active transaction - ignoring"); |
| 2179 | Ok(()) |
| 2180 | } |
| 2181 | Err(e) => Err(e), |
| 2182 | }?; |
| 2183 | Ok(()) |
| 2184 | }) |
| 2185 | } |
| 2186 | |
| 2187 | pub async fn rollback_with_session(&self, session_id: &Uuid) -> Result<(), PgSqliteError> { |
| 2188 | self.rollback(session_id).await |