From 72a52eb7b12312b3889280828640bf189e873c03 Mon Sep 17 00:00:00 2001 From: IMB11 Date: Fri, 1 Aug 2025 22:27:25 +0100 Subject: [PATCH] fix: improve error message for rate limiting (#4101) Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com> --- .../src/composables/servers/servers-fetch.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/frontend/src/composables/servers/servers-fetch.ts b/apps/frontend/src/composables/servers/servers-fetch.ts index 45bd48c68..29a63f7cc 100644 --- a/apps/frontend/src/composables/servers/servers-fetch.ts +++ b/apps/frontend/src/composables/servers/servers-fetch.ts @@ -147,7 +147,7 @@ export async function useServersFetch( 404: "Not Found", 405: "Method Not Allowed", 408: "Request Timeout", - 429: "Too Many Requests", + 429: "You're making requests too quickly. Please wait a moment and try again.", 500: "Internal Server Error", 502: "Bad Gateway", 503: "Service Unavailable", @@ -167,11 +167,17 @@ export async function useServersFetch( console.error("Fetch error:", error); const fetchError = new ModrinthServersFetchError( - `[Modrinth Servers] ${message}`, + `[Modrinth Servers] ${error.message}`, statusCode, error, ); - throw new ModrinthServerError(error.message, statusCode, fetchError, module, v1Error); + throw new ModrinthServerError( + `[Modrinth Servers] ${message}`, + statusCode, + fetchError, + module, + v1Error, + ); } const baseDelay = statusCode && statusCode >= 500 ? 5000 : 1000;