Custom Retrofit ErrorHandler gives UndeclaredThrowableException

前端 未结 1 1721
礼貌的吻别
礼貌的吻别 2021-01-05 07:15

Based on this post How should I handle "No internet connection" with Retrofit on Android

I made a custom ErrorHandler

private         


        
相关标签:
1条回答
  • 2021-01-05 07:54

    If you are returning a checked exception you need to declare it on the interface.

    interface MyService {
      Foo doFoo() throws MyNetworkError;
    }
    
    0 讨论(0)
提交回复
热议问题