Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print parsing errors to console #1448

Open
QuentinFarizon opened this issue Sep 21, 2023 · 0 comments
Open

Print parsing errors to console #1448

QuentinFarizon opened this issue Sep 21, 2023 · 0 comments

Comments

@QuentinFarizon
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @ngx-translate/core@14.0.0 for the project I'm working on.

When there are parsing errors of the translation file, the loading just doesn't happen, and the error message appear anywhere. It is impossible to know the line causing the issue, as well as the details.

I think the use/getTranslation methods should fail the Observable, so that it can be properly caught higher up the stack, but this is a first step to at least have the error somewhere

Here is the diff that solved my problem:

diff --git a/node_modules/@ngx-translate/core/fesm2020/ngx-translate-core.mjs b/node_modules/@ngx-translate/core/fesm2020/ngx-translate-core.mjs
index b8e86ec..e86de0c 100644
--- a/node_modules/@ngx-translate/core/fesm2020/ngx-translate-core.mjs
+++ b/node_modules/@ngx-translate/core/fesm2020/ngx-translate-core.mjs
@@ -434,6 +434,7 @@ class TranslateService {
                 this.pending = false;
             },
             error: (err) => {
+		console.error(err);
                 this.pending = false;
             }
         });
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

No branches or pull requests

1 participant