Skip to content

Commit 2e5ebf3

Browse files
add friendly messages for common http error codes
1 parent c059570 commit 2e5ebf3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

apps/webapp/app/utils/httpErrors.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,26 @@ export function friendlyErrorDisplay(statusCode: number, statusText?: string) {
55
title: "400: Bad request",
66
message: statusText ?? "The request was invalid.",
77
};
8+
case 401:
9+
return {
10+
title: "401: Unauthorized",
11+
message: statusText ?? "Please sign in to continue.",
12+
};
13+
case 403:
14+
return {
15+
title: "403: Forbidden",
16+
message: statusText ?? "You don't have permission to access this resource.",
17+
};
818
case 404:
919
return {
1020
title: "404: Page not found",
1121
message: statusText ?? "The page you're looking for doesn't exist.",
1222
};
23+
case 429:
24+
return {
25+
title: "429: Too many requests",
26+
message: statusText ?? "Please wait a moment and try again.",
27+
};
1328
case 500:
1429
return {
1530
title: "500: Server error",

0 commit comments

Comments
 (0)