restoreAutoCommit

internal fun restoreAutoCommit(failure: Throwable?)

Puts auto-commit back once a scope is over, however it ended.

A failure here is only rethrown when the scope was already failing, and then as a suppressed exception on failure rather than in its place. Out of a scope that committed it is logged and goes no further. What it commits there is the empty transaction the successful commit() left open behind it, which the server has no reason to refuse - so what fails is the socket, and a broken socket is already on the record: checkClosed raises NetworkException the next time anything touches this session, logged or not. Raising it here would only report a failed transaction for one whose work is in the database, and invite a retry that writes it twice.