errtracker-lib
v0.1.8
Published
A small lib to catch error and handle it.
Maintainers
Readme
ErrTracker Library
Usage scenarios
- Report to slack every error. Might create some slack distractions.
- Report
first of its kinderror only. Per device. Since the info about errors are kept in device's localstorage (if supported). - Report every error and store it in AWS. Working on it.
Config
Slack details
| Parameter name | type (default value) | mandatory | description | |------------------|--------|-----------|-----------------------------------| | webHookUrl | string | true | slack webhook generated by slack | | useConsoleLogger | boolean (false) | false | false | details you might need to provide | | details | object | false | details you might need to provide |
AWS example
| Parameter name | type | mandatory | description | |------------------|--------|-----------|-----------------------------------| | apiKey | string | true | header api key - granting access to api (generated on request, for now) | | token | string | true | id to store error | | useConsoleLogger | boolean| false | report about server side response, can provide custom logger | | url | string | false | where error was thrown | | details | object | false | details you might need to provide |
Config samples
Slack every error report
<script src="/path/to/errtracker-slack-lib.es5.js"></script>
<script>
(function(et, d, n) {
if (!et) {
return
}
et({
webHookUrl: 'https://hooks.slack.com/services/some_unique_id',
details: {
platform: n.platform,
userAgent: n.userAgent,
url: d.location
}
});
})(window['slackErrTracker'], window.document, window.navigator);
</script>Slack unique error report only example
<script src="/path/to/errtracker-unique-slack-lib.es5.js"></script>
<script>
(function(et, d, n) {
if (!et) {
return
}
et({
webHookUrl: 'https://hooks.slack.com/services/some_unique_id',
details: {
platform: n.platform,
userAgent: n.userAgent,
url: d.location
}
});
})(window['uniqueSlackErrTracker'], window.document, window.navigator);
</script>AWS example
<script src="/path/to/errtracker-lib.es5.js"></script>
<script>
(function(et, d, n) {
if (!et) {
return
}
et({
// mandatory
apiKey: 'xxxx-xxxx-xxxx',
token: 'xxxxxx-xxxx-xx-xxx-xxxxxxxxx',
// below are optional
useConsoleLogger: true,
url: d.location,
details: {
platform: n.platform,
userAgent: n.userAgent
}
});
})(window['errtracker'], window.document, window.navigator);
</script>