diff --git a/index.html b/index.html index 643db8a..e6f5754 100644 --- a/index.html +++ b/index.html @@ -144,11 +144,13 @@ } // fetch data and return json async function fetchJson(url, options = {}) { - let response = await fetch(url, options) + const response = await fetch(url, options) + const json = await response.json() if (response.ok) { - return await response.json() + return json } else { - throw new Error(response.statusText) + console.error(json) + throw new Error(json.description) } } function getFormattedTime(timestamp, format) {