Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A promise version of Sentry.captureError.
'use strict'
const Raven = require('raven')
exports.capture = function (err, options = {}) {
return new Promise((resolve, reject) => {
const client = new Raven.Client(RAVEN_DSN)
const listener = res => {
client.removeListener('logged', listener)
resolve(res)
}
client.once('logged', listener)
.once('error', err => {
client.removeListener('logged', listener)
reject(err)
})
client.captureError(err, options)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment