Skip to content
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

thrown errors aren't being reported #4

Closed
mvasin opened this issue Dec 18, 2022 · 1 comment
Closed

thrown errors aren't being reported #4

mvasin opened this issue Dec 18, 2022 · 1 comment

Comments

@mvasin
Copy link

mvasin commented Dec 18, 2022

If I rewrite app.controller.ts into

import { Controller, Get } from '@nestjs/common';
import { InjectSentry, SentryService } from '@ntegral/nestjs-sentry';
import { AppService } from './app.service';

@Controller()
export class AppController {
  constructor(
    @InjectSentry() private readonly client: SentryService,
    private readonly appService: AppService,
  ) {}

  @Get()
  getHello(): string {
    this.client.error('error reported via this.client.error') // <-- this is being reported to Sentry
    throw Error('thrown error from the example');            // <-- this is not being reported to Sentry
    return this.appService.getHello();
  }
}

I don't see unexpected errors (emulated here by throw Error()) reported to Sentry. Is this intentional? How am I supposed to hook up the library to have those errors reported?

@mvasin
Copy link
Author

mvasin commented Dec 18, 2022

I see, I missed this part in the readme:

async function bootstrap() {
  const app = await NestFactory.create(AppModule, { logger: false });

  app.useLogger(SentryService.SentryServiceInstance());
  await app.listen(3000);
}
bootstrap();

@mvasin mvasin closed this as completed Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant