【发布时间】:2016-01-14 08:53:53
【问题描述】:
我正在使用 Volley 库提供的 RequestFuture 进行 同步 api 调用。 当 status code 为 4xx/500 时,我需要处理错误响应。
try {
JSONObject response = future.get();
} catch (InterruptedException e) {
// exception handling
} catch (ExecutionException e) {
// exception handling
}
现在错误被 ExecutionException catch 子句捕获。如何从此错误中获取 NetworkResponse。
如何在 catch 子句中覆盖 onErrorListener。
【问题讨论】:
标签: error-handling android-volley synchronous