Show errors thrown from a function invoked by `mist.scheduleFunction` as popup?
birgersp opened this issue · 4 comments
Hello,
I've noticed that functions invoked by mist.scheduleFunction
are "lost" somewhere. Consider this script:
local function throwSomeError()
local obj = {}
print(obj.x.y.z)
end
throwSomeError()
Running this code will give me a popup error like this
However, the following code yields no such error:
local function throwSomeError()
local obj = {}
print(obj.x.y.z)
end
mist.scheduleFunction(throwSomeError,nil,timer.getTime()+1)
But of course, the function is erroneous, and in my opinion I should get an error (somewhere) so I can fix it.
Cheers!
Error is captured here then written to log. Could there be some way to throw this error to a popup dialog instead? Maybe have that as a setting when using mist?
Yeah that could be made an option. But I'd probably have it default set to off. I'm thinking of something that could be used to set whether different Logger types push a notification or not. So you could set the mist Logger functions built in to automatically push the notification or for your own Loggers. Maybe even utilize the in game trigger messages for a form of notifications.
Latest commit mist rev80 has added functionality for this.
At the top of mist there is now a table local to mist called mistSettings. info, warning, and error messages associated with mist.Loggers will look to these settings to determine whether or not is should display an error. By default they are set to false.
Awesome, thanks!