{"action":"created","issue":{"url":"https://api.github.com/repos/lephyrus/ngx-translate-messageformat-compiler/issues/19","repository_url":"https://api.github.com/repos/lephyrus/ngx-translate-messageformat-compiler","labels_url":"https://api.github.com/repos/lephyrus/ngx-translate-messageformat-compiler/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/lephyrus/ngx-translate-messageformat-compiler/issues/19/comments","events_url":"https://api.github.com/repos/lephyrus/ngx-translate-messageformat-compiler/issues/19/events","html_url":"https://github.com/lephyrus/ngx-translate-messageformat-compiler/issues/19","id":295340187,"number":19,"title":"Handle SyntaxError caused by property access syntax better","user":{"login":"pascallaprade","id":10932275,"avatar_url":"https://avatars0.githubusercontent.com/u/10932275?v=4","gravatar_id":"","url":"https://api.github.com/users/pascallaprade","html_url":"https://github.com/pascallaprade","followers_url":"https://api.github.com/users/pascallaprade/followers","following_url":"https://api.github.com/users/pascallaprade/following{/other_user}","gists_url":"https://api.github.com/users/pascallaprade/gists{/gist_id}","starred_url":"https://api.github.com/users/pascallaprade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pascallaprade/subscriptions","organizations_url":"https://api.github.com/users/pascallaprade/orgs","repos_url":"https://api.github.com/users/pascallaprade/repos","events_url":"https://api.github.com/users/pascallaprade/events{/privacy}","received_events_url":"https://api.github.com/users/pascallaprade/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-08T00:11:40Z","updated_at":"2018-05-14T11:49:37Z","closed_at":"2018-05-14T11:49:37Z","author_association":"NONE","body":"While your documentation clearly states that `You lose the ability to access object properties in your placeholders: 'Hello {name.first} {name.last}' won't work.`, the result of disregarding this rule is not obvious.\r\n\r\nIndeed, by integrating this compiler to an already existing code-base, we missed a single occurrence of a property access syntax in one of our placeholder, during a git merge operation, and the resulting error was actually a raw exception caught in the `catch` handler of the `bootstrapModule` call made in our main.ts file.\r\n\r\nHere is the exception I got: https://gist.github.com/pascallaprade/e5bced0d500dd2400166c5e725c2a3d8\r\n\r\nYou should capture this error and provide a prettier message to the user when the \"no-property-access\" rule is violated. Ideally, the error would point at the file, line and character where the rule was violated, spell out clearly the rule that is being violated, and should clearly state that the error is related to 'ngx-translate-messageformat-compiler', to help the user narrow down its search of the faulty syntax. Even better, the error message could suggest to the user how the problem could be fixed, i.e. by providing the desired property directly."},"comment":{"url":"https://api.github.com/repos/lephyrus/ngx-translate-messageformat-compiler/issues/comments/388789758","html_url":"https://github.com/lephyrus/ngx-translate-messageformat-compiler/issues/19#issuecomment-388789758","issue_url":"https://api.github.com/repos/lephyrus/ngx-translate-messageformat-compiler/issues/19","id":388789758,"user":{"login":"lephyrus","id":1394536,"avatar_url":"https://avatars0.githubusercontent.com/u/1394536?v=4","gravatar_id":"","url":"https://api.github.com/users/lephyrus","html_url":"https://github.com/lephyrus","followers_url":"https://api.github.com/users/lephyrus/followers","following_url":"https://api.github.com/users/lephyrus/following{/other_user}","gists_url":"https://api.github.com/users/lephyrus/gists{/gist_id}","starred_url":"https://api.github.com/users/lephyrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lephyrus/subscriptions","organizations_url":"https://api.github.com/users/lephyrus/orgs","repos_url":"https://api.github.com/users/lephyrus/repos","events_url":"https://api.github.com/users/lephyrus/events{/privacy}","received_events_url":"https://api.github.com/users/lephyrus/received_events","type":"User","site_admin":false},"created_at":"2018-05-14T11:49:37Z","updated_at":"2018-05-14T11:49:37Z","author_association":"OWNER","body":"Trying to implement your suggestions would increase the complexity of this library significantly. You may not realize this, but it doesn't really do much at all - look at the source code. To be honest, I don't think intercepting a parse error from `messageformat` and then figuring out where in the app the string came from is even possible without significant changes to ngx-translate/core. \r\n\r\nIn any case, even doing the research necessary is far more effort than I can and want to invest. PRs are welcome of course... :wink:\r\n\r\nHaving said that, I've just released v4.1.0 which includes `TranslateMessageFormatDebugCompiler`. It prints console log messages that should make it easier to figure out where a syntax error originates."}}
{"actor":{"display_login":"lephyrus"}}