hotwired / turbo-android

Android framework for making Turbo native apps
MIT License
407 stars 51 forks source link

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

Closed jayohms closed 4 months ago

jayohms commented 4 months ago

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 new TurboVisitError (sealed interface) is passed with one of the following error types:

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.