I have a class which extends SpiceRequest, but I need to call the onRequestFailure(SpiceException) method when a failure has occured in the loadDataFromNetwork() method. I tried to throw an exception inside that method but that doesn't fire the onRequestFailure(SpiceException) method.

How could I make this work?

有帮助吗?

解决方案

For sure something is wrong in your code, if you really throw an exception, it will be wrapped inside a SpiceException. Invoke spiceException.getCause() to get your original exception.

Check the logs, you should see that exception being processed inside RoboSpice. Maybe something wrong happens before with the cache, but normally the exception will be passed to the listener.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top