These are chat archives for canjs/canjs

25th
Jul 2016
Yann Nicolas
@yannart
Jul 25 2016 12:57
Hello, I need to implement a centralized error handling for our application that uses CanJS. The idea is that if there is an error in the JS, we send the error details to the server side to store it and analyze it. I browse a bit and found this issue that has no updates: canjs/canjs#1751
Anyone has a proven way of doing this? I was thinking on using JS "window.onerror" (see https://developer.mozilla.org/en/docs/Web/API/GlobalEventHandlers/onerror)
Yann Nicolas
@yannart
Jul 25 2016 14:27
Have you used for example http://www.stacktracejs.com/ in combination with CanJS?
Evgeniy
@evgeniy-klemin
Jul 25 2016 15:20
@yannart try getsentry.com with js plugin
Yann Nicolas
@yannart
Jul 25 2016 15:22
@evgeniy-klemin Thanks but we are looking to send the JS errors to our own servers, not to a third party service.
Thomas Sieverding
@Bajix
Jul 25 2016 16:41
@yannart Are all your JS errors server errors?
Yann Nicolas
@yannart
Jul 25 2016 16:53
@Bajix No, we could have server errors but also pure client side errors (e.g. bugs, incompatibilities...)
Thomas Sieverding
@Bajix
Jul 25 2016 17:26
Well, common things like validation failing, 404’s, authorization failing, etc should be handled in app
Then essentially everything else you can let be thrown, and send those errors to your server
Yann Nicolas
@yannart
Jul 25 2016 17:28
@Bajix Exactly, that is the idea. And that is the main doubt, is there is a recommended way to catch all those errors in CanJS and send them to the server.
http://www.stacktracejs.com/ Is supposed to be JS framework agnostic but I do not know if it is proven to work with CanJS...
Thomas Sieverding
@Bajix
Jul 25 2016 17:30
I don’t see why this is even a CanJS issue
Why do you think it wouldn’t work?
Yann Nicolas
@yannart
Jul 25 2016 17:31
@Bajix for me it should work. But I was getting some recommendations before going to the wrong direction
Thomas Sieverding
@Bajix
Jul 25 2016 17:32
I don’t see any red flags with using stacktracejs
Yann Nicolas
@yannart
Jul 25 2016 17:32
In case also a built-in mechanism was already part of CanJS...
@Bajix Great, thanks for your advice
Blake Israel
@bisrael
Jul 25 2016 17:33
@yannart -- i've had pretty good experience with Rollbar (https://rollbar.com)
Yann Nicolas
@yannart
Jul 25 2016 17:35
@bisrael Thanks but I just want to send the JS errors to our own servers, not to use a 3rd party service.
Blake Israel
@bisrael
Jul 25 2016 17:35
gotcha, makes sense
i think rollbar does custom deployments, but probably not free
stacktracejs seems like the right tool
Yann Nicolas
@yannart
Jul 25 2016 17:39
@bisrael great, thanks
Sunil George
@georgesunil81
Jul 25 2016 22:03
Had a quick question - I have included a component within an if helper in stache to control the visibility of the component like below -
{{if makeComponentVisible}} <my-component>...</my-component>
The problem is that whenever makeComponentVisible is true, it inserts the component again (thereby calling its init again) instead of just making it visible. Is there a way to specify the visibility of the component as opposed to initializing it again and again1?
Thomas Sieverding
@Bajix
Jul 25 2016 22:05
Yes, do that logic within the components template/content
Sunil George
@georgesunil81
Jul 25 2016 22:07
Ah! @Bajix, so you mean that within the component I check if things have to be made visible or not, and not in my main template?
Thomas Sieverding
@Bajix
Jul 25 2016 22:09
Yes
You could even have the visibilty state on your component, then use cross-bindings
Sunil George
@georgesunil81
Jul 25 2016 22:12
Ah I see. Thanks @Bajix