Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling #136

Open
Uriopass opened this issue Dec 24, 2023 · 1 comment
Open

Error handling #136

Uriopass opened this issue Dec 24, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Uriopass
Copy link
Contributor

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:

  • debug_assert! or log::error at the right places
  • Newtypes like NonZeroX or PositiveX (not very ergonomic)
  • Some kind of debug mode, like an inspector that could highlight issues/sizes/constraints
@Uriopass Uriopass changed the title Assertions Error handling Dec 24, 2023
@LPGhatguy LPGhatguy added the enhancement New feature or request label Dec 27, 2023
@LPGhatguy
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants