Skip to content

Fix/translation error handler#77

Merged
fccview merged 2 commits intodevelopfrom
fix/translation-error-handler
Apr 14, 2026
Merged

Fix/translation error handler#77
fccview merged 2 commits intodevelopfrom
fix/translation-error-handler

Conversation

@Arkmind
Copy link
Copy Markdown
Collaborator

@Arkmind Arkmind commented Apr 13, 2026

Fix/translation error handler

Fixes stray space in logger and the logger for translations.

Example

Old logs looked like

DEBUG [translation]  Error reading translation directory at path "/app/data/engines/startpage": 
 38 |  * @returns A promise that resolves to the translation record object, or an empty object if an error occurs.
 39 |  */
 40 | export const dynamicImportTranslationFiles = async (
 41 |   path: string,
 42 | ): Promise<TranslationRecord> => {
 43 |   const files = await readdir(join(path, "locales")).catch((e) => {
                                                           ^
 ENOENT: no such file or directory, scandir '/app/data/engines/startpage/locales'
     path: "/app/data/engines/startpage/locales",
  syscall: "scandir",
    errno: -2,
     code: "ENOENT"
 
       at async <anonymous> (/app/src/server/utils/translation.ts:43:54)
       at async <anonymous> (/app/src/server/utils/translation.ts:154:30)
       at async <anonymous> (/app/src/server/extensions/engines/registry.ts:203:30)
       at async loadFromDir (/app/src/server/extensions/registry-factory.ts:192:22)
       at async init (/app/src/server/extensions/registry-factory.ts:209:13)
       at async initEngines (/app/src/server/extensions/engines/registry.ts:545:24)

New logs looks like

DEBUG [translation] No "locales" directory found at path "/app/data/engines/startpage". Skipping translation.

Clanker

This pull request makes improvements to error handling and logging in the server utilities, specifically in the logger and translation-related functions. The main changes focus on making log messages clearer and ensuring that potential issues are logged with appropriate severity.

Logging improvements:

  • Updated the logger utility in logger.ts to ensure that color reset codes are properly appended at the end of log messages for better readability in the console.

Translation utilities:

  • In translation.ts, improved error handling when the locales directory is missing by simplifying the log message and removing the error object from the output, making logs less noisy.
  • Changed the log level from debug to warn when a translation file does not export an object, making it easier to spot potential translation issues.

@Arkmind Arkmind self-assigned this Apr 13, 2026
@fccview fccview marked this pull request as ready for review April 14, 2026 08:14
@fccview fccview merged commit 38c3abe into develop Apr 14, 2026
2 checks passed
@fccview fccview mentioned this pull request Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants