Is there a way to map errors in Retrofit? Whenever...
# squarelibraries
d
Is there a way to map errors in Retrofit? Whenever I receive an HttpException I want to parse it and turn it into a more domain specific error exception (
sealed class MyAppError : Throwable { ... }
). I can't find a good place to hook this up. Initially I thought I'd write a
CallAdapter.Factory
which simply wraps every adapter, but it needs to somehow get adapter from all other installed factories (itself included) and this'll create a endless recursion.
d
i have in-progress blog post about this, will send you a draft 🙂