Fix propagation of thrown exception while executing commands to database.