From 8d6aeb8336f98c01c571282450ff58fac8d9cfcf Mon Sep 17 00:00:00 2001 From: pxmpsdev Date: Sun, 9 Aug 2026 21:33:55 +0000 Subject: [PATCH] fix(server): use unknown in catch blocks - file.ts, config.ts: Error | any is redundant (any swallows Error) and triggers no-explicit-any. Use unknown and cast only where needed (error.stack). Aligns with strict TypeScript and avoids masking real errors. --- server/src/utils/config.ts | 2 +- server/src/utils/file.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/utils/config.ts b/server/src/utils/config.ts index a6073471d1..67a10e88b6 100644 --- a/server/src/utils/config.ts +++ b/server/src/utils/config.ts @@ -67,7 +67,7 @@ const loadFromFile = async ({ metadataRepo, logger }: RepoDeps, filepath: string try { const file = await metadataRepo.readFile(filepath); return loadYaml(file) as unknown; - } catch (error: Error | any) { + } catch (error: unknown) { logger.error(`Unable to load configuration file: ${filepath}`); logger.error(error); throw error; diff --git a/server/src/utils/file.ts b/server/src/utils/file.ts index 24d555f2fe..e0abe45f1f 100644 --- a/server/src/utils/file.ts +++ b/server/src/utils/file.ts @@ -71,7 +71,7 @@ export const sendFile = async ( } return await _sendFile(file.path, { dotfiles: 'allow' }); - } catch (error: Error | any) { + } catch (error: unknown) { // ignore client-closed connection if (isConnectionAborted(error) || res.headersSent) { return; @@ -79,7 +79,7 @@ export const sendFile = async ( // log non-http errors if (!(error instanceof HttpException)) { - logger.error(`Unable to send file: ${error}`, error.stack); + logger.error(`Unable to send file: ${error}`, (error as Error).stack); } next(new NotFoundException());