Skip to content

Commit 50da9c3

Browse files
committed
feat(project): first commit
0 parents  commit 50da9c3

9 files changed

+5592
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# node-waf configuration
20+
.lock-wscript
21+
22+
# Compiled binary addons (http://nodejs.org/api/addons.html)
23+
build/Release
24+
25+
# Dependency directory
26+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27+
node_modules
28+
.vscode

.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.*
2+
node_modules
3+
coverage
4+
test
5+
CHANGELOG.md

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v10

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018 Leonardo Gatica
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# graphql-notify-errors
2+
3+
[![npm version](https://img.shields.io/npm/v/graphql-notify-errors.svg?style=flat-square)](https://www.npmjs.com/package/graphql-notify-errors)
4+
[![npm downloads](https://img.shields.io/npm/dm/graphql-notify-errors.svg?style=flat-square)](https://www.npmjs.com/package/graphql-notify-errors)
5+
[![devDependency Status](https://img.shields.io/david/dev/eclass/graphql-notify-errors.svg?style=flat-square)](https://david-dm.org/eclass/graphql-notify-errors#info=devDependencies)
6+
7+
> Send errors captured by graphql to sentry, bugsnag or similar
8+
9+
## Installation
10+
11+
```bash
12+
npm i graphql-notify-errors
13+
```
14+
15+
## Use
16+
17+
```js
18+
const { formatError, GraphQLError } = require('graphql')
19+
const express = require('express')
20+
const Raven = require('raven')
21+
const NotifyErrors = require('graphql-notify-errors')
22+
23+
Raven.config(process.env.SENTRY_DSN).install()
24+
25+
const filter = err => !(err instanceof GraphQLError)
26+
const options = {
27+
formatError,
28+
filter,
29+
notify: Raven.captureException
30+
}
31+
const notifyErrors = new NotifyErrors(options)
32+
const app = express()
33+
app.use('/graphql', graphqlExpress(req => {
34+
return {
35+
schema,
36+
context: { req },
37+
formatError: err => notifyErrors.formatError(err)
38+
}
39+
})
40+
)
41+
```
42+
43+
## License
44+
45+
[MIT](https://tldrlegal.com/license/mit-license)

0 commit comments

Comments
 (0)