From 96f9ab3a1cb7785f399a9890ba68bc3c2cf93029 Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Sat, 15 Apr 2023 16:47:44 +0530 Subject: [PATCH] Bug fix --- index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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) {