我正在使用Robospice提供的Retrofit模塊。我正在進行異步翻新調用。問題是,如果我的電話不成功,我會得到一個改進錯誤,但在robospice中,我得到onSuccess中的反饋,而不是onFailure(RobospiceException)。在RetrofitError中捕獲錯誤並將其傳遞給RoboSpice錯誤
我正在使用下面的代碼來執行我的web服務調用。
mSpiceManager.execute(mProfileRequest, new ProfileRequestListener());
在ProfileRequest的loaddatafromnetwork電話如下:
@Override
public Profile loadDataFromNetwork() throws Exception {
initCountDownLatch();
//Adding a retrofit callback.
getService().getProfile("//profileid", new AbstractCallback<Profile>() {
@Override
public void success(Profile profile, Response response) {
super.success(profile, response);
ProfileRequest.this.profile = profile;
mCountDownLatch.countDown();
}
@Override
public void failure(RetrofitError retrofitError) {
super.failure(retrofitError);
mCountDownLatch.countDown();
}
});
mCountDownLatch.await();
return profile;
}
任何人都可以讓我知道Robospice怎麼能看到獲得onFailure處?在簡單的話有沒有人嘗試過implmenting與改造「異步調用」 robospice(含改造回調實行「)?
扔它怎麼樣?如何在@Override上捕獲改進錯誤 public void onFailure(final SpiceException spiceException)? – SoH 2014-11-04 14:16:49