Menu
Grafana Cloud

Error reporting

Faro registers two error handlers:

  1. onError: to catch unhandled exceptions.
  2. onunhandledrejection: to catch errors from rejected JavaScript Promises which don’t have rejection handlers attached.

The Faro data model for errors is a structured format containing the line number of the script file where the error occurred.

Enhance Script Error with full stack trace

When errors happen in third-party scripts, web browsers restrict access for security reasons and replace the contents of the errors with a generic “Script Error.” message.

If your trust the resources, you can instruct web browsers to reveal the error messages of third-party scripts:

Add crossorigin="anonymous" to the respective script tags to instruct the browser to set the mode to cors and the credentials mode to same-origin for that specific request.

html
<!-- https://mysite.com:443 -->
<script src="http://mysite.com/myscript.js" crossorigin="anonymous"></script>

The server’s HTTP response which delivers the script to the client needs to have the Access-Control-Allow-Origin header set:

htaccess
Access-Control-Allow-Origin: https://mysite.com:443