mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
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.
This commit is contained in:
parent
35c2a90fca
commit
8d6aeb8336
2 changed files with 3 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue