Skip to content

Commit a90933a

Browse files
committed
Add fallback json if stuff is broken
1 parent 300014f commit a90933a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/utils/releases.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { resolve } from "node:path/posix";
2+
13
interface Release {
24
name: string;
35
body: string;
@@ -31,8 +33,8 @@ export async function fetchRelease(repo: string): Promise<Release[]> {
3133
return cached;
3234
}
3335

34-
const json = (await fetch(`https://api.github.com/repos/${repo}/releases`, options).then((response) =>
35-
response.json()
36+
const json = (await fetch(`https://api.github.com/repos/${repo}/releases`, options).then((r) =>
37+
r.ok ? r.json() : [{}]
3638
)) as any[];
3739

3840
const out: Release[] = json

0 commit comments

Comments
 (0)