https://github.com/eclass/graphql-notify-errors
Send errors captured by graphql to sentry, bugsnag or similar
https://github.com/eclass/graphql-notify-errors
eclass error-handling graphql
Last synced: 10 days ago
JSON representation
Send errors captured by graphql to sentry, bugsnag or similar
- Host: GitHub
- URL: https://github.com/eclass/graphql-notify-errors
- Owner: eclass
- License: mit
- Created: 2018-05-07T20:41:59.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-11-15T20:27:27.000Z (over 1 year ago)
- Last Synced: 2024-11-15T21:24:33.234Z (over 1 year ago)
- Topics: eclass, error-handling, graphql
- Language: JavaScript
- Size: 164 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# graphql-notify-errors
[](https://www.npmjs.com/package/graphql-notify-errors)
[](https://www.npmjs.com/package/graphql-notify-errors)
[](https://david-dm.org/eclass/graphql-notify-errors#info=devDependencies)
> Send errors captured by graphql to sentry, bugsnag or similar
## Installation
```bash
npm i graphql-notify-errors
```
## Use
```js
const { formatError, GraphQLError } = require('graphql')
const express = require('express')
const Raven = require('raven')
const NotifyErrors = require('graphql-notify-errors')
Raven.config(process.env.SENTRY_DSN).install()
const filter = err => !(err instanceof GraphQLError)
const options = {
formatError,
filter,
notify: Raven.captureException
}
const notifyErrors = new NotifyErrors(options)
const app = express()
app.use('/graphql', graphqlExpress(req => {
return {
schema,
context: { req },
formatError: err => notifyErrors.formatError(err)
}
})
)
```
## License
[MIT](https://tldrlegal.com/license/mit-license)