SecondHalfGames / yakui

yakui is a declarative Rust UI library for games
Apache License 2.0
237 stars 21 forks source link

Error handling #136

Open Uriopass opened 11 months ago

Uriopass commented 11 months ago

Sometimes parameter don't make sense: negative radius, flex=0 for a spacer.

I also think of infinitely sized objects that can crash the painter in debug (overflow error when building the rect).

What should be the strategy to help the user?

I can think of a few ways:

LPGhatguy commented 11 months ago

I like the idea of having a debug mode like Flutter's that highlights issues. I think it's a little unintuitive to debug Flutter issues in practice, so I wonder how we could better surface errors and warnings.

I wonder if the best way to do that is as part of some larger "yakui inspector" project.

What do you think about having debug log::error/warn variants that log only once per call site within a given widget? We could keep around a set of the log messages that have happened, keyed by the address of &'static std::panic::Location. That'd give us an easy way to surface error and warning messages without blowing up someone's console.