Change: log entire body for http error

This commit is contained in:
eight 2019-09-27 13:44:31 +08:00
parent c2646c7c1a
commit bd6dd4b917

View File

@ -87,10 +87,9 @@ const tokenManager = (() => {
if (r.ok) { if (r.ok) {
return r.json(); return r.json();
} }
return r.json() return r.text()
.catch(console.warn) .then(body => {
.then(json => { throw new Error(`failed to fetch (${r.status}): ${body}`);
throw new Error(`failed to fetch (${r.status}): ${json && json.message}`);
}); });
}) })
.then(result => .then(result =>