Skip to content

Commit

Permalink
fix: dont log for throwOnError when disabled (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiin committed Sep 9, 2024
1 parent 764e5bb commit 434f37b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nestjs-i18n",
"version": "10.4.7",
"version": "10.4.8",
"homepage": "https://nestjs-i18n.com",
"description": "The i18n module for Nest.",
"author": "Toon van Strijp",
Expand Down
3 changes: 2 additions & 1 deletion src/services/i18n.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ export class I18nService<K = Record<string, unknown>>
}" in "${lang}" does not exist.`;
if (lang !== this.i18nOptions.fallbackLanguage || !!defaultValue) {
if (this.i18nOptions.logging && this.i18nOptions.throwOnMissingKey) {

this.logger.error(translationKeyMissing);
throw new I18nError(translationKeyMissing);
}

Expand All @@ -126,7 +128,6 @@ export class I18nService<K = Record<string, unknown>>
}
}

this.logger.error(translationKeyMissing);
}

return (translation ?? key) as unknown as IfAnyOrNever<R, string, R>;
Expand Down

0 comments on commit 434f37b

Please sign in to comment.