You've already forked AstralRinth
fix: improve error message for rate limiting (#4101)
Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
@@ -147,7 +147,7 @@ export async function useServersFetch<T>(
|
|||||||
404: "Not Found",
|
404: "Not Found",
|
||||||
405: "Method Not Allowed",
|
405: "Method Not Allowed",
|
||||||
408: "Request Timeout",
|
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",
|
500: "Internal Server Error",
|
||||||
502: "Bad Gateway",
|
502: "Bad Gateway",
|
||||||
503: "Service Unavailable",
|
503: "Service Unavailable",
|
||||||
@@ -167,11 +167,17 @@ export async function useServersFetch<T>(
|
|||||||
console.error("Fetch error:", error);
|
console.error("Fetch error:", error);
|
||||||
|
|
||||||
const fetchError = new ModrinthServersFetchError(
|
const fetchError = new ModrinthServersFetchError(
|
||||||
`[Modrinth Servers] ${message}`,
|
`[Modrinth Servers] ${error.message}`,
|
||||||
statusCode,
|
statusCode,
|
||||||
error,
|
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;
|
const baseDelay = statusCode && statusCode >= 500 ? 5000 : 1000;
|
||||||
|
|||||||
Reference in New Issue
Block a user