diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-03-04 14:19:44 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-03-04 14:19:49 -0800 |
| commit | 026f7bf0e41c8d2c310a9795e8ed4e147927146e (patch) | |
| tree | 5d42a6f9a256f77055e4a6e8ae0b441ce6a32bb5 /error_handling.moon | |
| parent | 30a7473d106caafedec53d65aa03fdc92f17d372 (diff) | |
Better error reporting
Diffstat (limited to 'error_handling.moon')
| -rw-r--r-- | error_handling.moon | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/error_handling.moon b/error_handling.moon index 207ed07..41d2fe1 100644 --- a/error_handling.moon +++ b/error_handling.moon @@ -61,7 +61,10 @@ enhance_error = (error_message)-> 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 + if fn_name = error_message\match("attempt to call a nil value %(method '(.*)'%)") + action_name = fn_name\from_lua_id! + error_message = "This object does not have the method '#{action_name}'." + elseif 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! |
