Expand my Community achievements bar.

Capturing JavaScript Errors in events,error messsage and error url etc in eVars

Avatar

Level 1

Hi Team,

 

I have lot of rules which are configured in Adobe Launch which has lot of JavaScript custom codes written, some of them are throwing errors in console, where they haven't used try catch method also. I just want to know does we can be able to capture the error as event also error message, error code in eVar.

 

Kindly any inputs on this.

 

Thanks & Regards,

Rahul

2 Replies

Avatar

Community Advisor

It might or might not be possible to track the errors. It depends on whether those errors result in the tracking beacon failing to be sent at all. If the tracking beacon can't be sent, then tracking the error in an eVar would be useless since it would never reach AA.

Since you're able to see that these errors are occurring, you should go into the relevant Custom Code in your Launch rules and fix them. And while you're there, make sure you test for as many scenarios as possible. Also, use JSLint as a first-check to validate your code.

Avatar

Community Advisor

What you should do is set up proper release process: 

  • You should always have one of your peers to review your build to validate there is no coding issues: peer review process
  • You should always test your build in production before releasing. You can use the official AEP google chrome extension to overwrite the launch library in production by the one you built in the development environment
    • Check for any error logs during this process and fix the issues.
  • You should only ever release if peer review and testing is completed.
  • Also for good measures do a post-release testing on production.

Also you mentioned "where they haven't used try catch method also.", when writing custom code you should never forget the try/catch and the catch should not be silent otherwise you will never know it fails:

use something meaningful in error like: `_satellite.logger.error('Failed in rule X in function X to set bla', e)`

 

Finally have a look at these for tagging, coding and release standards:

https://dev.to/alcazes/adobe-launch-release-standards-2c9m

https://dev.to/alcazes/adobe-launch-tagging-standards-3aak

https://dev.to/alcazes/adobe-launch-coding-standards-e22