core icon indicating copy to clipboard operation
core copied to clipboard

Print parsing errors to console

Open QuentinFarizon opened this issue 10 months ago • 0 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @ngx-translate/[email protected] 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;
             }
         });

QuentinFarizon avatar Sep 21 '23 10:09 QuentinFarizon