GenieFramework / Stipple.jl

The reactive UI library for interactive data applications with pure Julia.
MIT License
317 stars 27 forks source link

Stacktrace in function inside on() does not propagate back to stdout/stderr #17

Open szafna opened 3 years ago

szafna commented 3 years ago

Hi, I have a small stipple reactive app. It is really nice and reactive and responsive framework. I have observers and use on() function. There are some functions from my package inside on() function. I've found out if there is an error somewhere in my function, error/stacktrace is not get propagated back to stdout/stderr. Execution of on() function just silently breaks - returns out of on() function. Is there a way to get these errors to stdout/err? Probably I have just missed obvious settings or pattern?

essenciary commented 3 years ago

Hi!

This is implemented using Observables.jl - I'm not sure if it provides any API for bubbling the exceptions into the main thread. It would be interesting though.

szafna commented 3 years ago

Hi, @essenciary I've did some additional tests and found out: -if observables is changed in REPL - ex: myobject.data[]="something", stacktrace is written to stdout/stderr -if observables is changed in browser, stacktrace is not written to stdout/stderr Could this be related with threading in Stipple?

essenciary commented 3 years ago

Ah, interesting, thanks for the update. I presume that when done in the REPL the change is performed in the main thread and the exceptions bubble up. But possibly when done through the framework the updates go through a separate thread and they don't bubble up in the main thread. I need to check, I don't remember how things are set up.

cwiese commented 2 years ago

Yes! THis is killing me. Debugging is very hard. I have to go back to adding @info statements between every line. Is this due to @async to Genie using Threads? .. We had a similar issue is Remote Processes and had to add exception handling and logging.

hhaensel commented 2 years ago

I agree 100%. I have three modes of workaround, depending on the level of difficulty.

The last version also makes your code nicely readable if your projects groes larger.

Happy coding :-)

essenciary commented 2 years ago

Sorry about this, I'll see if I can find a solution to rethrow the exception or show a dump of the error.

szafna commented 2 years ago

@hhaensel the 4th workaround, I am aware, is to put in a try catch in on() do block.

cwiese commented 2 years ago

this is great tips .. thank you. I will post my fav. Also, I do remember having to put try/catched on remote_fetch functions and adding a logger.