Skip to content

Commit

Permalink
fix: do not cache images on error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jabolol committed Jan 10, 2024
1 parent 644565e commit 68d550a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ export const fetchBytes = async (
const data = func.pipe(
url,
taskEither.tryCatchK(
() => fetch(url),
async () => {
const request = await fetch(url);
if (!request.ok) {
throw new Error(`Request failed with status ${request.status}`);
}
return request;
},
(reason) => new Error(String(reason)),
),
taskEither.map((response) => response.arrayBuffer()),
Expand Down

0 comments on commit 68d550a

Please sign in to comment.