diff --git a/db/src/main/java/dev/openrs2/db/Database.kt b/db/src/main/java/dev/openrs2/db/Database.kt index 7d3fc8239f..26edba1a9d 100644 --- a/db/src/main/java/dev/openrs2/db/Database.kt +++ b/db/src/main/java/dev/openrs2/db/Database.kt @@ -85,13 +85,16 @@ public class Database( connection.autoCommit = false try { - try { - val result = transaction.execute(connection) - connection.commit() - return result - } finally { + val result = try { + transaction.execute(connection) + } catch (t: Throwable) { connection.rollback() + throw t } + + connection.commit() + + return result } finally { connection.autoCommit = oldAutoCommit }