|
@@ -70,19 +70,31 @@ public class LuRequest {
|
70
|
70
|
@Override
|
71
|
71
|
public void onErrorResponse(VolleyError error) {
|
72
|
72
|
int code = 0;
|
73
|
|
- if (error != null && error.networkResponse != null)
|
74
|
|
- {
|
75
|
|
- code = error.networkResponse.statusCode;
|
76
|
|
- }
|
77
|
73
|
try
|
78
|
74
|
{
|
79
|
|
- JSONObject data = new JSONObject(new String(error.networkResponse.data));
|
80
|
|
- promise.reject(new LuPromise.LuPromiseError(data.getString("Message"), code));
|
|
75
|
+ if (error != null) {
|
|
76
|
+ if (error.networkResponse != null)
|
|
77
|
+ {
|
|
78
|
+ code = error.networkResponse.statusCode;
|
|
79
|
+ JSONObject data = new JSONObject(new String(error.networkResponse.data));
|
|
80
|
+ promise.reject(new LuPromise.LuPromiseError(data.getString("Message"), code));
|
|
81
|
+ }
|
|
82
|
+ else {
|
|
83
|
+ if (error.getCause() != null) {
|
|
84
|
+ promise.reject(new LuPromise.LuPromiseError(error.getCause().getMessage(), code));
|
|
85
|
+ }
|
|
86
|
+ else {
|
|
87
|
+ promise.reject(new LuPromise.LuPromiseError(error.toString(), code));
|
|
88
|
+ }
|
|
89
|
+ }
|
|
90
|
+ }
|
|
91
|
+ else {
|
|
92
|
+ promise.reject(new LuPromise.LuPromiseError("Unknown network error", code));
|
|
93
|
+ }
|
81
|
94
|
} catch (Exception e)
|
82
|
95
|
{
|
83
|
96
|
promise.reject(new LuPromise.LuPromiseError(e.getMessage(), code));
|
84
|
97
|
}
|
85
|
|
- promise.reject(new LuPromise.LuPromiseError(error.toString(), code));
|
86
|
98
|
}
|
87
|
99
|
};
|
88
|
100
|
}
|