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

Allow returning errors from eframe app creator #4474

Open
emilk opened this issue May 7, 2024 · 0 comments
Open

Allow returning errors from eframe app creator #4474

emilk opened this issue May 7, 2024 · 0 comments
Labels
eframe Relates to epi and eframe

Comments

@emilk
Copy link
Owner

emilk commented May 7, 2024

eframe::run_native takes a closure that creates the user's application. We should have some way of returning errors from it.

It already has a rather complicated signature:

pub type AppCreator = Box<dyn FnOnce(&CreationContext<'_>) -> Box<dyn App>>;

And that would need to become something like

type DynError = Box<dyn std::error::Error>;
pub type AppCreator = Box<dyn FnOnce(&CreationContext<'_>) -> Result<Box<dyn App>>, DynError>;

…unless we can come up with something nicer.

Motivation

In Rerun we initialize the renderer in the app creation callback, and that can fail because of missing features of the host GPU.

@emilk emilk added this to the Next Major Release milestone May 7, 2024
@emilk emilk added the eframe Relates to epi and eframe label May 7, 2024
emilk added a commit to rerun-io/rerun that referenced this issue May 10, 2024
### What
Using `scripts/fetch_crashes.py` to look at our analytics, I noticed
that missing wgpu capabilities would lead to a assert/panic, which is
not a nice way to report errors to users.

I added an egui issue to improve this further in the future:
* emilk/egui#4474

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6252?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6252?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/6252)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
eframe Relates to epi and eframe
Projects
None yet
Development

No branches or pull requests

1 participant