How to use the @sentry/node.Handlers.errorHandler function in @sentry/node

To help you get started, we’ve selected a few @sentry/node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github unwelch / unwel.ch / backend / src / server.js View on Github external
}

  if (version === '0') {
    const newToken = upgradeToken(token)
    res.status(400)
    res.send({ error: 'old-version', newToken })
    return
  }

  res.status(400)
  res.send({ error: 'invalid-token' })
})

if (process.env.NODE_ENV === 'production') {
  // The error handler must be before any other error middleware
  app.use(sentryHandlers.errorHandler())
}

app.get('/_health', (_, res) => {
  res.json({ ok: true })
})

console.log('Starting server...')
app.listen(3000)