GenieFramework / Stipple.jl

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

@event does not propagate errors #286

Open PGimenez opened 3 months ago

PGimenez commented 3 months ago

When an error happens within an @event block, it is not printed and the block fails silently.

MWE:

using GenieFramework
@genietools

@app begin
    @in error = false
    @onbutton error begin
        println("Error ")
        a = nonexistantvar
        println("This will never be printed")
    end
    @event :error_event begin
        println("Error event")
        a = nonexistantvar
        println("This will never be printed")
    end
end

ui() = btn("Error 1", @click(:error)) * btn("Error 2", @on(:click, :error_event))

@page("/", ui)
up()

This is what is printed to the REPL:

Error
┌ Warning: 2024-08-06 10:42:01 UndefVarError(:nonexistantvar)
└ @ Stipple ~/.julia/packages/Stipple/Hr6Qa/src/Stipple.jl:999
Error event
essenciary commented 3 months ago

@PGimenez The error is printed (granted as a warning) though? What would you expect to happen?

PGimenez commented 3 months ago

@PGimenez The error is printed (granted as a warning) though? What would you expect to happen?

I'm talking about the @event block. it prints Error event but it doesnt show an error when executing the a=nonexisttantvarline

essenciary commented 3 months ago

I don't get it... it says here:

┌ Warning: 2024-08-06 10:42:01 UndefVarError(:nonexistantvar)
└ @ Stipple ~/.julia/packages/Stipple/Hr6Qa/src/Stipple.jl:999
essenciary commented 3 months ago

Ah, that's from the other one... Thanks for making the example more complicated 😂