Skip to content

Commit 9f94154

Browse files
authored
feat: handle 404 from github gracefully (#418)
* feat: handle 404 from github gracefully * changeset
1 parent 30ba873 commit 9f94154

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rnef/provider-github': patch
3+
---
4+
5+
feat: handle 404 from github gracefully

packages/provider-github/src/lib/artifacts.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,23 @@ Update the token under "${color.bold(
9191
)}" key in ${color.cyan('rnef.config.mjs')} config file.
9292
9393
📘 Read more about generating a new token: ${color.cyan(
94-
'https://www.rnef.dev/docs/remote-cache/github-actions/configuration#generate-github-personal-access-token-for-downloading-cached-builds'
94+
'https://rnef.dev/docs/remote-cache/github-actions/configuration#generate-github-personal-access-token-for-downloading-cached-builds'
95+
)}`
96+
);
97+
}
98+
if ((error as { message: string }).message.includes('404 Not Found')) {
99+
throw new RnefError(
100+
`Failed to fetch GitHub artifacts due to "404 Not Found" error. This can happen for the following reasons:
101+
- permission mismatch between your GitHub Personal Access Token and the repository
102+
- you're blocked by the owner of the repository
103+
- repository address is incorrect
104+
105+
Make sure the repository information and token under "${color.bold(
106+
'remoteCacheProvider'
107+
)}" key in ${color.cyan('rnef.config.mjs')} config file is valid.
108+
109+
📘 Read more about generating a new token: ${color.cyan(
110+
'https://rnef.dev/docs/remote-cache/github-actions/configuration#generate-github-personal-access-token-for-downloading-cached-builds'
95111
)}`
96112
);
97113
}

0 commit comments

Comments
 (0)