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.
This resolves error ambiguity issues outlined in https://github.com/hotwired/turbo-android/issues/242
Instead of simply passing an
errorCode
when visits fail, a newTurboVisitError
(sealed interface) is passed with one of the following error types:WebError
: representsWebView
errors mapped fromandroidx.webkit.WebViewClientCompat
WebSslError
: represents SSL errors mapped fromandroid.net.http.SslError
HttpError
: represents HTTP status code error returned from the serverLoadError
: represents custom load errors whenturbo.js
fails to load on the pageThis 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.