style: fix linting issues met Prettier
This commit is contained in:
parent
b8aae0ab1b
commit
f347ec247d
33 changed files with 90 additions and 361 deletions
|
@ -12,11 +12,7 @@ const logger: Logger = getLogger();
|
|||
* @param params
|
||||
* @returns The response data if successful, or null if an error occurs.
|
||||
*/
|
||||
export async function fetchWithLogging<T>(
|
||||
url: string,
|
||||
description: string,
|
||||
params?: Record<string, any>
|
||||
): Promise<T | null> {
|
||||
export async function fetchWithLogging<T>(url: string, description: string, params?: Record<string, any>): Promise<T | null> {
|
||||
try {
|
||||
const config: AxiosRequestConfig = params ? { params } : {};
|
||||
|
||||
|
@ -25,19 +21,14 @@ export async function fetchWithLogging<T>(
|
|||
} catch (error: any) {
|
||||
if (error.response) {
|
||||
if (error.response.status === 404) {
|
||||
logger.debug(
|
||||
`❌ ERROR: ${description} not found (404) at "${url}".`
|
||||
);
|
||||
logger.debug(`❌ ERROR: ${description} not found (404) at "${url}".`);
|
||||
} else {
|
||||
logger.debug(
|
||||
`❌ ERROR: Failed to fetch ${description}. Status: ${error.response.status} - ${error.response.statusText} (URL: "${url}")`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
logger.debug(
|
||||
`❌ ERROR: Network or unexpected error when fetching ${description}:`,
|
||||
error.message
|
||||
);
|
||||
logger.debug(`❌ ERROR: Network or unexpected error when fetching ${description}:`, error.message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -36,9 +36,7 @@ export function getNumericEnvVar(envVar: EnvVar): number {
|
|||
const valueString = getEnvVar(envVar);
|
||||
const value = parseInt(valueString);
|
||||
if (isNaN(value)) {
|
||||
throw new Error(
|
||||
`Invalid value for environment variable ${envVar.key}: ${valueString}. Expected a number.`
|
||||
);
|
||||
throw new Error(`Invalid value for environment variable ${envVar.key}: ${valueString}. Expected a number.`);
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
|
|
|
@ -12,15 +12,8 @@ export function loadTranslations<T>(language: string): T {
|
|||
const yamlFile = fs.readFileSync(filePath, 'utf8');
|
||||
return yaml.load(yamlFile) as T;
|
||||
} catch (error) {
|
||||
logger.warn(
|
||||
`Cannot load translation for ${language}, fallen back to dutch`,
|
||||
error
|
||||
);
|
||||
const fallbackPath = path.join(
|
||||
process.cwd(),
|
||||
'_i18n',
|
||||
`${FALLBACK_LANG}.yml`
|
||||
);
|
||||
logger.warn(`Cannot load translation for ${language}, fallen back to dutch`, error);
|
||||
const fallbackPath = path.join(process.cwd(), '_i18n', `${FALLBACK_LANG}.yml`);
|
||||
return yaml.load(fs.readFileSync(fallbackPath, 'utf8')) as T;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue