Skip to content

Commit ede96ab

Browse files
committed
return JSON promise directly so that it throws in malformed JSON
1 parent 4957f2e commit ede96ab

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

fetch/programmer-humour/script.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ async function fetchXKCDComic() {
44
if (!response.ok) {
55
throw new Error(`Response status: ${response.status}`);
66
}
7-
const result = await response.json();
8-
return result;
7+
return response.json();
98
}
109

1110
async function displayComic() {

0 commit comments

Comments
 (0)