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

Pass more detailed visit errors to apps to avoid ambiguity #317

Merged
merged 7 commits into from
Feb 28, 2024

Conversation

jayohms
Copy link
Collaborator

@jayohms jayohms commented Feb 26, 2024

This resolves error ambiguity issues outlined in #242

Instead of simply passing an errorCode when visits fail, a new TurboVisitError (sealed interface) is passed with one of the following error types:

  • WebError: represents WebView errors mapped from androidx.webkit.WebViewClientCompat
  • WebSslError: represents SSL errors mapped from android.net.http.SslError
  • HttpError: represents HTTP status code error returned from the server
  • LoadError: represents custom load errors when turbo.js fails to load on the page

This is a minor breaking API change if an app has implemented a custom error view, but the fix is trivial and worth the trade-off. By encapsulating the errors in a custom sealed interface, it allows for future flexibility (without further breaking API changes) if we want to pass along more granular data along with errors, such as helpful descriptions for error views, or add new error types.

@jayohms jayohms marked this pull request as ready for review February 26, 2024 17:58
Copy link
Contributor

@mbarta mbarta left a comment

Choose a reason for hiding this comment

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

Nice improvement! 👏

Copy link
Contributor

@jhutarek jhutarek left a comment

Choose a reason for hiding this comment

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

Nice, thanks! 👍

@jayohms jayohms merged commit 5db9f9d into main Feb 28, 2024
1 check passed
@jayohms jayohms deleted the visit-errors branch February 28, 2024 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants