Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get Sentry to log errors within try-catch #427

Closed
Jedeu opened this issue Jun 7, 2022 · 0 comments
Closed

How to get Sentry to log errors within try-catch #427

Jedeu opened this issue Jun 7, 2022 · 0 comments
Labels

Comments

@Jedeu
Copy link

Jedeu commented Jun 7, 2022

Hi I'm seeing Sentry send uncaught errors but nothing found within a try-catch block. I read this earlier question and wanted to see if my setup might be preventing Sentry from sending the errors over. Thanks in advance!

server/index.js (entrypoint)

const Routers = require('./routers');
const config = require('./config');
app.use('baseUrl', Routers);
const nuxt = new Nuxt(config);
await nuxt.ready();

app.use(nuxt.render);

routers.js

  const router = require('express').Router();
  const MySpace = require('./services/MySpace');

  router.use('/my_space', MySpace);

MySpace.js

  async doTheThing(req, res) {
    try {
      // execute some logic
    } catch (e) {
      // process.sentry.captureException(e) <--- I need to manually add this if I want to send stuff to Sentry, hoping to send any errors over automatically
      return res.status(500).json(e);
    }
  }

  Router.post('/do_the_thing', doTheThing);

nuxt.config.js

sentry: {
    dsn: myDsn,
    tracing: true,
    config: {
      debug: true,
    },
},
@Jedeu Jedeu added the question label Jun 7, 2022
@nuxt-community nuxt-community locked and limited conversation to collaborators Jun 8, 2022
@rchl rchl converted this issue into discussion #428 Jun 8, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

1 participant