aboutsummaryrefslogtreecommitdiff
path: root/error_handling.moon
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-02-02 19:43:13 -0800
committerBruce Hill <bruce@bruce-hill.com>2019-02-02 19:43:17 -0800
commit2e52c1a7a8dff525b3f617ec56ed3950cd222845 (patch)
tree7f72271f9f1833a91d3c935b62da0c58355a6560 /error_handling.moon
parentfb435c308a13f60253af65d0850211b75f934ef2 (diff)
Added comments.
Diffstat (limited to 'error_handling.moon')
-rw-r--r--error_handling.moon3
1 files changed, 3 insertions, 0 deletions
diff --git a/error_handling.moon b/error_handling.moon
index b69b75f..207ed07 100644
--- a/error_handling.moon
+++ b/error_handling.moon
@@ -60,12 +60,15 @@ enhance_error = (error_message)->
-- Hacky: detect the line numbering
unless error_message and error_message\match("%d|")
error_message or= ""
+ -- When calling 'nil' actions, make a better error message
if fn_name = (error_message\match("attempt to call a nil value %(global '(.*)'%)") or
error_message\match("attempt to call global '(.*)' %(a nil value%)"))
action_name = fn_name\from_lua_id!
error_message = "The action '#{action_name}' is not defined."
+ -- Look for simple misspellings:
+
-- This check is necessary for handling both top-level code and code inside a fn
func = debug.getinfo(2,'f').func
ename,env = debug.getupvalue(func, 1)