Skip to content

Commit 2497fcb

Browse files
Handle 404 error with a custom solution suggestion when importing
profile with a code
1 parent 0ce615f commit 2497fcb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/r2mm/profiles/ProfilesClient.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ function formatApiError<T>(e: T, genericTitle: string): R2Error | T {
1919
message,
2020
"You were rate limited by the server, wait for a while and try again."
2121
);
22+
} else if (e.response.status === 404) {
23+
// Note that this error text is only applicable when importing, but it should be OK as creating a profile shouldn't respond with 404 anyway.
24+
return new R2Error(
25+
genericTitle,
26+
`Server responded with \"404: Not Found\" while trying to download the profile`,
27+
`The profile import code entered might either be expired or contain typos.`
28+
);
2229
} else {
2330
return new R2Error(
2431
genericTitle,

0 commit comments

Comments
 (0)