-
-
Notifications
You must be signed in to change notification settings - Fork 575
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
How to catch malformed JSON lang file when loading. #751
Comments
I would also expect a descriptive error in my console when the JSON is malformed. Currently we get no indication of what goes wrong. A missing comma in our translation file cost us time to debug than we'd like to admit. |
The best place to catch an invalid json file is creating your own The default implementation is quite simple: https://github.com/ngx-translate/http-loader/blob/master/src/http-loader.ts
... or make sure to only work with valid json files... BE might help you. ;) |
If I write a malformed en.json file by adding a comma at the wrong place, when I run my app, I get a very generic error log: [09:54:31] console.error: ERROR [object Object] from somewhere within the library.
I have tried the following:
The Error section never triggers when attempting to load the malformed JSON. Where can I put a catcher to detect that mistake?
I'm using:
"@ngx-translate/core": "^9.0.1",
"@ngx-translate/http-loader": "^2.0.0",
The text was updated successfully, but these errors were encountered: