fix: improve type safety and add error logging (#378)
- Replace 'as any' with proper type definition for error status code access - Add error logging to sendPresenceUpdate() catch block - Add debug logging when .env file is not found These changes improve type safety and visibility into potential failures without changing any core functionality. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: gavrielc <gabicohen22@yahoo.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { logger } from './logger.js';
|
||||
|
||||
/**
|
||||
* Parse the .env file and return values for the requested keys.
|
||||
@@ -12,7 +13,8 @@ export function readEnvFile(keys: string[]): Record<string, string> {
|
||||
let content: string;
|
||||
try {
|
||||
content = fs.readFileSync(envFile, 'utf-8');
|
||||
} catch {
|
||||
} catch (err) {
|
||||
logger.debug({ err }, '.env file not found, using defaults');
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user