Skip to content

Commit 6695fef

Browse files
committed
☕ fix error handling for fetch
1 parent 52419c7 commit 6695fef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.scripts/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as streams from "@std/streams";
66
*/
77
export async function downloadString(url: string): Promise<string> {
88
const response = await fetch(url);
9-
if (!response.body) {
9+
if (response.status >= 400 || !response.body) {
1010
throw new Error(`Failed to read ${url}`);
1111
}
1212
//const reader = streams.readerFromStreamReader(response.body.getReader());

0 commit comments

Comments
 (0)