Development note: appfail-reporting.js must pass JSHint Linting in order for it to be valid.
To begin reporting Javascript failures to appfail, add the following script tag into your page:
<script type="text/javascript" src="https://s3.amazonaws.com/appfail-us/appfail.reporting.min.js?slug=abc123"></script>
OK, so you've plugged in the reporting script, but your not seeing any failures in Appfail. Have you written perfect Javascript code, or is something going wrong!?
You can fire a 'test' exception at appfail from your page, by adding the following value to your page's query string: http://myurl.com/somepage?appfail-report-test-exception=1
Appfail's reporting module can be configured by modifying the query string of the URL in the <script /> tag, or by calling a javascript function.
Settings that can be configured, and their defaults:
appfail.configure({
slug: 'abc123', // your app slug
processInterval: 10, // how often the errors should be sent to the server (try not to DDoS it!)
daysToStore: 7, // number of days before stored errors are invalidated
onBeforeStore: null // function to parse the report values before it's stored or sent to the server
});
Query string Each of these settings can be configured via the query string of the URL in the <script /> include.
<script type="text/javascript" src="https://s3.amazonaws.com/appfail-us/appfail.reporting.min.js?slug=abc123"></script>
The following functions are exposed
appfail.reporting.catchManual(e)use with atry {} catch(e) {}appfail.reporting.processQueue()for manually sending the queue of errorsappfail.reporting.storeQueue()push the currentmessageQueuetolocalStorageappfail.reporting.loadStoredErrors()restore the saved errors fromlocalStorageto the internalmessageQueue. Note: This does not automatically runprocessQueue, and will need to be manually triggered.
The REST API for Appfail is documented here: http://support.appfail.net/kb/rest-api-for-reporting-failures/rest-api-documentation-for-failure-reporting