projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c5329d8
)
libs/web: add assert() statements for unresolvable function case
author
Jo-Philipp Wich
<jow@openwrt.org>
Wed, 30 Nov 2011 12:50:32 +0000
(12:50 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Wed, 30 Nov 2011 12:50:32 +0000
(12:50 +0000)
libs/web/luasrc/dispatcher.lua
patch
|
blob
|
history
diff --git
a/libs/web/luasrc/dispatcher.lua
b/libs/web/luasrc/dispatcher.lua
index
911f2f4
..
7c77f2e
100644
(file)
--- a/
libs/web/luasrc/dispatcher.lua
+++ b/
libs/web/luasrc/dispatcher.lua
@@
-761,10
+761,18
@@
end
local function _call(self, ...)
local function _call(self, ...)
+ local func = getfenv()[self.name]
+ assert(func ~= nil,
+ 'Cannot resolve function "' .. self.name .. '". Is it misspelled or local?')
+
+ assert(type(func) == "function",
+ 'The symbol "' .. self.name .. '" does not refer to a function but data ' ..
+ 'of type "' .. type(func) .. '".')
+
if #self.argv > 0 then
if #self.argv > 0 then
- return
getfenv()[self.name]
(unpack(self.argv), ...)
+ return
func
(unpack(self.argv), ...)
else
else
- return
getfenv()[self.name]
(...)
+ return
func
(...)
end
end
end
end