Skip to content

Remove panic in case Builder::setup hook fails #12815

@thomaseizinger

Description

@thomaseizinger

Recording this as a follow-up item from #12668. Currently, App::run as well as App::run_return will panic if the setup hook provided in Builder::setup fails.

This isn't very clean and we should instead cleanly shut-down the application (where possible). I believe this can be achieved by refactoring the callback passed to the runtime to support returning a value (like ControlFlow or Result). On platforms that support it (everything but iOS I think?), this could abort the event-loop and return a value which in turn would allow Tauri to gracefully return from run and run_return.

As we do this, we may want to consider deprecating App::run altogether and perhaps simply document that on iOS, App::run_return will never return. Maybe we can even express this in the type-signature with a cfg and a never-like type?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: breaking changeThis issue or pull request will introduce a breaking change and requires major version bumptype: feature request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions