Skip to content

Commit 72a52eb

Browse files
IMB11Prospector
andauthored
fix: improve error message for rate limiting (#4101)
Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
1 parent b33e12c commit 72a52eb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

apps/frontend/src/composables/servers/servers-fetch.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export async function useServersFetch<T>(
147147
404: "Not Found",
148148
405: "Method Not Allowed",
149149
408: "Request Timeout",
150-
429: "Too Many Requests",
150+
429: "You're making requests too quickly. Please wait a moment and try again.",
151151
500: "Internal Server Error",
152152
502: "Bad Gateway",
153153
503: "Service Unavailable",
@@ -167,11 +167,17 @@ export async function useServersFetch<T>(
167167
console.error("Fetch error:", error);
168168

169169
const fetchError = new ModrinthServersFetchError(
170-
`[Modrinth Servers] ${message}`,
170+
`[Modrinth Servers] ${error.message}`,
171171
statusCode,
172172
error,
173173
);
174-
throw new ModrinthServerError(error.message, statusCode, fetchError, module, v1Error);
174+
throw new ModrinthServerError(
175+
`[Modrinth Servers] ${message}`,
176+
statusCode,
177+
fetchError,
178+
module,
179+
v1Error,
180+
);
175181
}
176182

177183
const baseDelay = statusCode && statusCode >= 500 ? 5000 : 1000;

0 commit comments

Comments
 (0)