Question

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?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top