openLuup response to incorrect timer call

Assume code is as follows:

luup.call_timer(Timer_End_Light_Garage, 1, '5m')

Timer_End_Light_Garage should be string not a function pointer. openLuup says:

openLuup.context_switch::  ERROR: ./openLuup/luup.lua:385: attempt to concatenate a function value

Could this be altered to say something along the lines of:

openLuup.context_switch::  ERROR: ./openLuup/luup.lua:385:  "function name 'Timer_End_Light_Garage' should be a string"

I’ve concentrated on getting the functionality of calls correct when used with the right parameters, rather than a fully comprehensive list of possible errors. Extensive parameter checking would slow down the system by some amount. But, along with a revamp of the error logging system, this is something which could be done better.

However, having made that mistake, you’re never going to do it again, are you? :wink:

The latest development branch update includes error checking for this (and also the new luup.ir.pronto_to_gc100() call.)

All luup functions which require text function names, rather than actual functions, use this. viz.

[ul][li]call_delay[/li]
[li]call_timer[/li]
[li]job_watch[/li]
[li]register_handler[/li]
[li]variable_watch[/li][/ul]

Instead of the previous obscure error at some point in the guts of openLuup, it now also reports the code line where the error occurred…

[string "ALTUI - LuaRunHandler"]:24: parameter #1 should be type string but is function