Improve error handling.

master
Tom Hacohen 6 years ago
parent 6456625716
commit c25ac2d6c0

@ -338,7 +338,11 @@ class BaseNetwork {
if (response.ok) { if (response.ok) {
resolve(body); resolve(body);
} else { } else {
reject(new HTTPError(json.detail || json.non_field_errors)); if (json) {
reject(new HTTPError(json.detail || json.non_field_errors || JSON.stringify(json)));
} else {
reject(new HTTPError(body));
}
} }
}).catch((error) => { }).catch((error) => {
reject(error); reject(error);

Loading…
Cancel
Save