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

Generated bindings still have throw even with ErrorHandlingMode set to Result #135

Open
nooblyf opened this issue Sep 29, 2024 · 2 comments

Comments

@nooblyf
Copy link

nooblyf commented Sep 29, 2024

is there a way to avoid tauri-specta from doing these

if (e instanceof Error) throw e;

Screenshot 2024-09-30 at 01 29 59

@oscartbeaumont
Copy link
Member

This is an interesting one and it esentially comes down to do you want Result<T, unknown> or Result<T, TErr> where TErr is the error type in Rust. I think both are reasonable but I think the latter is going to be the more useful hence why we choose it.

Typescript doesn't let us know what errors can actually occur so we can't properly type it unless we make this distinction. In practice i'm not sure if Tauri throws errors or not so I don't know if you will hit this or not (but I assume you might have to report this).

I suspect we might want to implement ErrorHandlingMode::ResultUnknown or something like that to always catch the Tauri errors and change the error type on the function to never.

@oscartbeaumont

This comment was marked as off-topic.

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

No branches or pull requests

2 participants