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

Better error message for invalid custom scheme name on webkit #1295

Closed
ottomated opened this issue Jun 16, 2024 · 2 comments · Fixed by #1301
Closed

Better error message for invalid custom scheme name on webkit #1295

ottomated opened this issue Jun 16, 2024 · 2 comments · Fixed by #1301

Comments

@ottomated
Copy link

Is your feature request related to a problem? Please describe.

When registering an invalid scheme like so .register_asynchronous_uri_scheme_protocol("in_valid", ...), the error (on macos) is:

thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wry-0.40.1/src/wkwebview/mod.rs:403:18:
Uncaught exception <NSException: 0x149f0c280>
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
libc++abi: terminating due to uncaught foreign exception

Describe the solution you'd like
Either the scheme name should be validated on the Rust end beforehand or the error from webkit should be handled better.

Additional context
Tested on tauri 2.0.0-beta

@pewsheen
Copy link
Contributor

Thanks for the report!
Currently, the objc crate we are using can't tell which NSException it is, so we don't know if the thrown exception is either the scheme name is invalid, or it's already been registered. Checking the name before using it looks more promising for now.

@ottomated
Copy link
Author

Honestly, even The schema "in_valid" is invalid or already registered would be enough in my opinion. The issue right now is that it doesn't point to scheme registration at all

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

Successfully merging a pull request may close this issue.

2 participants