Skip to content
This repository was archived by the owner on Oct 13, 2026. It is now read-only.
This repository was archived by the owner on Oct 13, 2026. It is now read-only.

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

Closed

Description

@Jedeu

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,
    },
},

Activity

  1. locked and limited conversation to collaborators on Jun 8, 2022
  2. converted this issue into a discussion #428 on Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions