3

Anyone have any idea how I can call the onFailure callback from the Interceptor class attached to the OkHttp client?

2
  • 1
    Try to throw an exception. When an interceptor throws an exception, okhttp calls the onFailure callback
    – bvarga
    Feb 14, 2017 at 21:39
  • @warnyul Thanks you're right.
    – Mikerizzo
    Feb 15, 2017 at 13:40

2 Answers 2

2

@warnyul comment was right. Once I threw the IOException, it triggered the failure.

1

Try to throw an exception. When an interceptor throws an exception, okhttp calls the onFailure callback

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.