CERTIFICATE_VERIFY_FAILED crash in _RawSecureSocket._tryFilter#4529
CERTIFICATE_VERIFY_FAILED crash in _RawSecureSocket._tryFilter#4529
Conversation
Add catch clauses for HandshakeException (CERTIFICATE_VERIFY_FAILED) and TlsException in the retry loop, and return a synthetic 503 response instead of crashing the app on TLS/certificate errors. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request effectively resolves a crash caused by CERTIFICATE_VERIFY_FAILED by introducing error handling for HandshakeException and TlsException. The approach of returning a synthetic 503 response is a good strategy to prevent the app from crashing while signaling a transport-level issue to the rest of the application. The included suggestions to simplify the implementation by leveraging the class hierarchy of these exceptions are valid and should make the code slightly more concise and maintainable.
| } on HandshakeException catch (e) { | ||
| lastError = e; | ||
| } on TlsException catch (e) { | ||
| lastError = e; |
There was a problem hiding this comment.
Since HandshakeException is a subtype of TlsException, you can simplify this by catching only TlsException. This will handle HandshakeException and any other potential TLS-related exceptions (like CertificateException) in a single block.
} on TlsException catch (e) {
// This catches HandshakeException and other TlsExceptions.
lastError = e;
}| if (lastResponse != null) return lastResponse; | ||
|
|
||
| // Return synthetic 503 for TLS/certificate errors instead of crashing | ||
| if (lastError is HandshakeException || lastError is TlsException) { |
|
A better fix is to not allow the app which doesn't support TLS (disabled that app) |
|
Hey @aaravgarg 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! 💜 |
which app was it curious |
Summary
HandshakeExceptionandTlsExceptionin the HTTP retry loopCrash Stats
Test plan
🤖 Generated with Claude Code