summaryrefslogtreecommitdiffstats
path: root/provisioning-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2015-12-28 16:24:04 +0000
committerTed Trask <ttrask01@yahoo.com>2015-12-28 16:24:04 +0000
commitb818b8f33db2547fee487672ac2389c407391da0 (patch)
treed2b9566c8ee631e68c4787fb3329921aaef767a2 /provisioning-model.lua
parentfbe71548bafcf2bdcb85afe1ef0aa94b81a4c225 (diff)
downloadacf-provisioning-b818b8f33db2547fee487672ac2389c407391da0.tar.bz2
acf-provisioning-b818b8f33db2547fee487672ac2389c407391da0.tar.xz
Need to pass error text into handlesqlexception
Diffstat (limited to 'provisioning-model.lua')
-rw-r--r--provisioning-model.lua84
1 files changed, 42 insertions, 42 deletions
diff --git a/provisioning-model.lua b/provisioning-model.lua
index 3fc0f50..807d08e 100644
--- a/provisioning-model.lua
+++ b/provisioning-model.lua
@@ -145,7 +145,7 @@ local databasedisconnect = function()
provdb.databasedisconnect()
end
-local handlesqlexception = function(connected)
+local handlesqlexception = function(connected, err)
-- Can't trust cache, so clear it
saved_devices = nil
saved_device_params = nil
@@ -347,7 +347,7 @@ local get_device = function(device_id, create)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
@@ -423,7 +423,7 @@ local get_device_params = function(device_id, editable)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
end
@@ -487,7 +487,7 @@ local set_device_params = function(params, editable)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
success = false
errtxt = err
end
@@ -523,7 +523,7 @@ local get_device_values = function(device_id)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
else
@@ -560,7 +560,7 @@ mymodule.list_templates = function()
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
local reversed = {}
@@ -616,7 +616,7 @@ mymodule.get_template = function(self, clientdata)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
end
@@ -677,7 +677,7 @@ mymodule.update_template = function(self, template, action, create)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
success = false
errtxt = err
end
@@ -720,7 +720,7 @@ mymodule.delete_template = function(self, delreq)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
delreq.errtxt = err
end
@@ -739,7 +739,7 @@ mymodule.list_class_groups = function()
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
@@ -774,7 +774,7 @@ mymodule.get_class_group = function(self, clientdata)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
@@ -836,7 +836,7 @@ mymodule.update_class_group = function(self, group, action, create)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
success = false
errtxt = err
end
@@ -876,7 +876,7 @@ mymodule.delete_class_group = function(self, delreq)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
delreq.errtxt = err
end
@@ -895,7 +895,7 @@ mymodule.list_classes = function()
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
@@ -957,7 +957,7 @@ mymodule.get_class = function(self, clientdata)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
@@ -1025,7 +1025,7 @@ mymodule.update_class = function(self, class, action, create)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
success = false
errtxt = err
end
@@ -1067,7 +1067,7 @@ mymodule.delete_class = function(self, delreq)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
delreq.errtxt = err
end
@@ -1086,7 +1086,7 @@ mymodule.list_groups = function()
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
@@ -1160,7 +1160,7 @@ mymodule.get_group = function(self, clientdata)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
@@ -1265,7 +1265,7 @@ mymodule.update_group = function(self, group, action, create)
end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
success = false
errtxt = err
end
@@ -1307,7 +1307,7 @@ mymodule.delete_group = function(self, delreq)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
delreq.errtxt = err
end
@@ -1326,7 +1326,7 @@ mymodule.list_params = function()
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
@@ -1366,7 +1366,7 @@ mymodule.get_param = function(self, clientdata)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
@@ -1450,7 +1450,7 @@ mymodule.update_param = function(self, param, action, create)
end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
success = false
errtxt = err
end
@@ -1492,7 +1492,7 @@ mymodule.delete_param = function(self, delreq)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
delreq.errtxt = err
end
@@ -1582,7 +1582,7 @@ mymodule.list_devices = function(self, clientdata)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
retval.errtxt = err
end
@@ -1662,7 +1662,7 @@ mymodule.update_device = function(self, device, action, create)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
success = false
errtxt = err
end
@@ -1711,7 +1711,7 @@ mymodule.delete_device = function(self, delreq)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
delreq.errtxt = err
end
@@ -1773,7 +1773,7 @@ mymodule.get_class_values = function(self, retval)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
retval.errtxt = err
end
end
@@ -1807,7 +1807,7 @@ mymodule.fetch_device_values = function(self, search)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
search.errtxt = err
end
@@ -1843,7 +1843,7 @@ mymodule.get_search_options = function()
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
return cfe({type="group", value=retval, label="Device Search", errtxt=errtxt})
@@ -1891,7 +1891,7 @@ mymodule.search_device_values = function(self, search)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
search.errtxt = err
end
else
@@ -1930,7 +1930,7 @@ mymodule.get_param_options = function(self, clientdata)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
errtxt = err
end
end
@@ -1972,7 +1972,7 @@ mymodule.set_param_options = function(self, options)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
success = false
errtxt = err
end
@@ -2075,7 +2075,7 @@ function mymodule.dump_database(self, db)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
db.errtxt = err
end
return db
@@ -2132,7 +2132,7 @@ function mymodule.get_file(self, clientdata)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
result.errtxt = err
end
@@ -2174,7 +2174,7 @@ function mymodule.put_file(self, clientdata)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
retval.errtxt = err
end
return retval
@@ -2249,7 +2249,7 @@ mymodule.list_requests = function(self, clientdata)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
retval.errtxt = err
end
@@ -2282,7 +2282,7 @@ mymodule.delete_request = function(self, delreq)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
delreq.errtxt = err
end
@@ -2341,7 +2341,7 @@ mymodule.create_from_request = function(self, request)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
request.errtxt = err
end
@@ -2504,7 +2504,7 @@ mymodule.bulk_create_devices = function(self, devicelist)
if connected then databasedisconnect() end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
devicelist.errtxt = err
end
@@ -2586,7 +2586,7 @@ mymodule.bulk_dump_devices = function(self, dumprequest)
end
end)
if not res and err then
- handlesqlexception(connected)
+ handlesqlexception(connected, err)
dumprequest.errtxt = err
end