0.0.5 • Published 4 years ago
@bugout/humbug v0.0.5
Humbug JavaScript
The Humbug JavaScript library.
Installation
Using npm
npm install --save @bugout/humbugFrom source
Clone this repository and enter this directory. Make sure you have node.js installed and then build javascript library from typescript:
npm install
npm run buildIntegrations
Prepare Humbug and fill your token API key:
import Reporter, { HumbugConsent } from "@bugout/humbug"
const BUGOUT_TOKEN = "06a1a299-c6b4-4709-8ac5-650d5e78e53e"Instantiate the reporter:
const consent = HumbugConsent(true)
const reporter = new Reporter(
"<name>",
consent,
"<client_id>",
"<session_id>",
BUGOUT_TOKEN
)Unhandled exceptions with process.on
tags = ["app_version"]
process.on('uncaughtException', err => {
console.error('There was an uncaught error', err)
reporter.systemReport(tags, true)
reporter.errorReport(err, tags, true)
})Your customized exceptions
Add to your PersonalError class errorReport:
class PersonalError extends Error {
constructor(messsage = "") {
super(messsage)
this.name = "PersonalError"
reporter.errorReport(this, [version], true)
}
}