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

Handle panics without crashing the app #23

Closed
alexwkleung opened this issue Jun 30, 2023 · 1 comment
Closed

Handle panics without crashing the app #23

alexwkleung opened this issue Jun 30, 2023 · 1 comment
Assignees
Labels
bug Something isn't working enhancement New feature or request general General discussion of a specific topic in progress Improvements/fixes/anything in progress

Comments

@alexwkleung
Copy link
Owner

When a user does an action that causes a panic (Rust side), it crashes the app.

Since this isn't the ideal behaviour, I would like to handle this preferably as an alert of some sort on the JS side. However on the Rust side, I'm not sure if handling errors using the panic! macro is appropriate for all cases.

In vague terms:

panic! is meant for unrecoverable errors and it destroys the entire stack in memory after it gets executed, causing the app to crash by default

I'll have to take a closer look at this later on. Without handling these edge cases correctly, the flow of the app will diminish and the UX won't feel as robust.

@alexwkleung alexwkleung added bug Something isn't working enhancement New feature or request in progress Improvements/fixes/anything in progress general General discussion of a specific topic labels Jun 30, 2023
@alexwkleung alexwkleung self-assigned this Jun 30, 2023
@alexwkleung
Copy link
Owner Author

On the front-end, I make sure to return early when a supposed panic could happen. A dialog appears as well.

Closing since v0.2.0-dev-5.0 will have these changes. Might not be 100% but it's a good start.

Of course I want to make the back-end more rigid in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request general General discussion of a specific topic in progress Improvements/fixes/anything in progress
Projects
None yet
Development

No branches or pull requests

1 participant