in src/util/submit-addon.js [306:324]
async fetchJson(url, method = 'GET', body, errorMsg = 'Bad Request') {
const response = await this.fetch(url, method, body);
if (response.status < 200 || response.status >= 500) {
throw new Error(
`${errorMsg}: ${response.statusText || response.status}.`,
);
}
const data = await response.json();
if (!response.ok) {
throw new Error(
[
`${errorMsg}: ${response.statusText || response.status}`,
JSON.stringify(data, null, 2),
].join('\n'),
);
}
return data;
}