From 1bb9e4416a705db1093ee1d43c83ce49005a17a2 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 24 Dec 2015 18:24:31 +0000 Subject: Fix database exception handling if occurs during connection attempt --- provisioning-model.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/provisioning-model.lua b/provisioning-model.lua index 0ad268e..8388210 100644 --- a/provisioning-model.lua +++ b/provisioning-model.lua @@ -154,8 +154,11 @@ local handlesqlexception = function(connected) mymodule.logevent(sql) pcall(function() con:execute(sql) end) provdb.databasedisconnect() - else + elseif provdb.isconnected() then + -- database connection ocurred in calling function, propagate the error error(err) + else + -- failure during connection, no cleanup needed end end -- cgit v1.2.3