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

fix(macos): do not ignore errors on sending HTTP responses #1372

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

rhysd
Copy link
Contributor

@rhysd rhysd commented Sep 26, 2024

All errors on sending HTTP responses are ignored on macOS.

let _ = response(task, webview_id, url, sent_response);

This PR changes to check the errors. When some error happens, it now causes a panic.

@rhysd rhysd requested a review from a team as a code owner September 26, 2024 15:06
"wry": patch
---

On macOS, do not ignore errors on sending HTTP resopnses. Errors now cause panics.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think our users would appreciate panics, we should instead just log::error the result

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, does it mean users can recover the error when it occurs? This is an internal error and users don't know why it happened. And there is no other way to receive a response via custom protocol. For unrecoverable errors, I believe panics are a correct way to handle them.

https://doc.rust-lang.org/beta/book/ch09-03-to-panic-or-not-to-panic.html

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucasfernog what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the quote from the rust book applies well to gui applications. gui apps should really never crash like this, or at least not from inside a library (from someone else than the app dev), but of course the dev not having a way to react to those errors is quite problematic too, hmm 🤔

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 this pull request may close these issues.

3 participants