Skip to content

Commit 921285c

Browse files
add friendly messages for common http error codes (#3001)
Closes #<issue> ## ✅ Checklist - [ x] I have followed every step in the [contributing guide](https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md) - [x ] The PR title follows the convention. - [ x] I ran and tested the code works --- ## Testing Verified the error message mapping logic locally and ensured existing behavior remains unchanged. --- ## Changelog Added friendly messages for HTTP 401, 403, and 429 errors. <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/triggerdotdev/trigger.dev/pull/3001"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end -->
1 parent 667a93c commit 921285c

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)