-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathrollbar.js
34 lines (26 loc) · 874 Bytes
/
rollbar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const Rollbar = require('rollbar')
const { isProd } = require('./config')
const { rollbar: rollbarSecret } = require('./secret')
if (isProd) {
global.rollbar = new Rollbar({
accessToken: rollbarSecret.accessToken,
captureUncaught: true,
captureUnhandledRejections: true,
checkIgnore: (isUncaught, args) => {
const err = args[0]
// Never ignore uncaught errors
if (isUncaught) return false
// Ignore 'Bad Request' errors
if (err.status === 400) return true
// Ignore 'Forbidden' errors
if (err.status === 403) return true
// Ignore 'Not Found' errors
if (err.status === 404) return true
// Ignore 'Precondition Failed' errors
if (err.status === 412) return true
// Ignore 'Range Not Satisfiable' errors
if (err.status === 416) return true
return false
}
})
}