You've already forked AstralRinth
fix: show hostname on modrinth servers 503 (#4678)
* fix: show hostname on modrinth servers 503 * fix: lint
This commit is contained in:
@@ -30,7 +30,7 @@ export async function useServersFetch<T>(
|
||||
'[Modrinth Servers] Cannot fetch without auth',
|
||||
10000,
|
||||
)
|
||||
throw new ModrinthServerError('Missing auth token', 401, error, module)
|
||||
throw new ModrinthServerError('Missing auth token', 401, error, module, undefined, undefined)
|
||||
}
|
||||
|
||||
const {
|
||||
@@ -52,7 +52,14 @@ export async function useServersFetch<T>(
|
||||
'[Modrinth Servers] Circuit breaker open - too many recent failures',
|
||||
503,
|
||||
)
|
||||
throw new ModrinthServerError('Service temporarily unavailable', 503, error, module)
|
||||
throw new ModrinthServerError(
|
||||
'Service temporarily unavailable',
|
||||
503,
|
||||
error,
|
||||
module,
|
||||
undefined,
|
||||
undefined,
|
||||
)
|
||||
}
|
||||
|
||||
if (now - lastFailureTime.value > 30000) {
|
||||
@@ -69,7 +76,14 @@ export async function useServersFetch<T>(
|
||||
'[Modrinth Servers] Cannot fetch without base url. Make sure to set a PYRO_BASE_URL in environment variables',
|
||||
10001,
|
||||
)
|
||||
throw new ModrinthServerError('Configuration error: Missing PYRO_BASE_URL', 500, error, module)
|
||||
throw new ModrinthServerError(
|
||||
'Configuration error: Missing PYRO_BASE_URL',
|
||||
500,
|
||||
error,
|
||||
module,
|
||||
undefined,
|
||||
undefined,
|
||||
)
|
||||
}
|
||||
|
||||
const versionString = `v${version}`
|
||||
@@ -179,6 +193,7 @@ export async function useServersFetch<T>(
|
||||
fetchError,
|
||||
module,
|
||||
v1Error,
|
||||
error.data,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -200,6 +215,8 @@ export async function useServersFetch<T>(
|
||||
undefined,
|
||||
fetchError,
|
||||
module,
|
||||
undefined,
|
||||
undefined,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -212,7 +229,14 @@ export async function useServersFetch<T>(
|
||||
statusCode,
|
||||
lastError,
|
||||
)
|
||||
throw new ModrinthServerError('Maximum retry attempts reached', statusCode, pyroError, module)
|
||||
throw new ModrinthServerError(
|
||||
'Maximum retry attempts reached',
|
||||
statusCode,
|
||||
pyroError,
|
||||
module,
|
||||
undefined,
|
||||
lastError.data,
|
||||
)
|
||||
}
|
||||
|
||||
const fetchError = new ModrinthServersFetchError(
|
||||
@@ -220,5 +244,12 @@ export async function useServersFetch<T>(
|
||||
undefined,
|
||||
lastError || undefined,
|
||||
)
|
||||
throw new ModrinthServerError('Maximum retry attempts reached', undefined, fetchError, module)
|
||||
throw new ModrinthServerError(
|
||||
'Maximum retry attempts reached',
|
||||
undefined,
|
||||
fetchError,
|
||||
module,
|
||||
undefined,
|
||||
undefined,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1043,7 +1043,10 @@ const nodeUnavailableDetails = computed(() => [
|
||||
},
|
||||
{
|
||||
label: 'Node',
|
||||
value: server.general?.datacenter ?? 'Unknown',
|
||||
value:
|
||||
server.moduleErrors?.general?.error.responseData?.hostname ??
|
||||
server.general?.datacenter ??
|
||||
'Unknown',
|
||||
type: 'inline' as const,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ export class ModrinthServerError extends Error {
|
||||
public readonly originalError?: Error,
|
||||
public readonly module?: string,
|
||||
public readonly v1Error?: V1ErrorInfo,
|
||||
public readonly responseData?: any,
|
||||
) {
|
||||
let errorMessage = message
|
||||
let method = 'GET'
|
||||
|
||||
Reference in New Issue
Block a user