js: fix OperationQueue error handling

When an exception is raised, `response.json()` may have been called
already. In that case, when accessing `response.text()` in the error
handler, a "Response.text: Body has already been
consumed." error will be raised.
This commit is contained in:
Pierre de La Morinerie 2022-02-15 11:21:06 +00:00
parent c848fc6d00
commit 50cafc033f

View file

@ -45,7 +45,7 @@ async function handleError({ response, message }, reject) {
try {
const {
errors: [message]
} = await response.json();
} = await response.clone().json();
reject(message);
} catch {
reject(await response.text());