Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/articulate/paperplane-bugsnag
A bugsnag wrapper for paperplane
https://github.com/articulate/paperplane-bugsnag
bugsnag error-reporting exception-reporting javascript notifier paperplane
Last synced: about 1 month ago
JSON representation
A bugsnag wrapper for paperplane
- Host: GitHub
- URL: https://github.com/articulate/paperplane-bugsnag
- Owner: articulate
- License: mit
- Created: 2018-08-31T14:07:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-14T16:52:16.000Z (about 5 years ago)
- Last Synced: 2024-04-29T21:23:25.994Z (8 months ago)
- Topics: bugsnag, error-reporting, exception-reporting, javascript, notifier, paperplane
- Language: JavaScript
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 57
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
paperplane-bugsnag
Abugsnag
wrapper forpaperplane
.
Filters `Boom` client errors (4xx) and `Joi` validation errors by default, and adds request data to the error notification for debugging.## Usage
Setup your `bugsnag` like this:
```js
// server/lib/bugsnag.jsconst bugsnag = require('bugsnag')
const bugsnagClient = bugsnag({
apiKey: process.env.BUGSNAG_API_KEY,
notifyReleaseStages: ['prod', 'stage'],
releaseStage: process.env.SERVICE_ENV
})const optionalCustomLogger =
err => console.error(`My custom logged error: ${err.message}`)module.exports = require('paperplane-bugsnag')(bugsnagClient, optionalCustomLogger)
```Then use it as the `cry` option in `paperplane` like this:
```js
// server/index.jsconst http = require('http')
const { mount } = require('paperplane')const app = require('./rest')
const cry = require('./lib/bugsnag').notifyhttp.createServer(mount({ app, cry })).listen(3000, cry)
```By default, `Boom` client errors (4xx) and `Joi` validitation errors will be ignored.
```js
// server/rest.js
module.exports = req => {
const err = Boom.badRequest()
return Promise.reject(err) // does not send notification
}
```We can force a notification by setting `cry=true` on the error.
```js
// server/rest.js
module.exports = req => {
const err = Boom.badRequest()
err.cry = true
return Promise.reject(err) // sends notification
}
```