How to use the nest-raven.RavenInterceptor function in nest-raven

To help you get started, we’ve selected a few nest-raven 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 mentos1386 / lynx / src / modules / demo / demo.controller.ts View on Github external
this.loggerService.debug('debug');
    this.loggerService.info('info');
    this.loggerService.silly('silly');
  }

  @Get('/exception/custom')
  public async exceptionCustom() {
    throw new UserBlockedException();
  }

  @Get('/exception/sentry')
  public async exceptionSentry() {
    throw new HttpException('Should be cached by sentry', HttpStatus.INTERNAL_SERVER_ERROR);
  }

  @UseInterceptors(RavenInterceptor({
    filters: [
      { type: HttpException, filter: (exception: HttpException) => 500 > exception.getStatus() },
    ],
    tags: {
      tryingOut: 'ravenInterceptor',
    },
    level: 'warning',
  }))
  @Get('/exception/http')
  public async exceptionHttp() {
    throw new Error('some error');
    // throw new BadRequestException({ message: 'this should be', with: ['an', 'array'] });
  }

  @Post('/upload')
  @UseInterceptors(StorageInterceptor('file', STORAGE_TYPE.DISK))
github mentos1386 / lynx / src / modules / app.module.ts View on Github external
AuthenticationModule, // Required for AuthMiddleware

    // Init TypeOrm
    TypeOrmModule.forRoot(),
    // Init Router
    RouterModule.forRoutes(appRoutes),
    // Init Raven
    RavenModule.forRoot(),

    UserModule,
    DemoModule,
  ],
  providers: [
    {
      provide: APP_INTERCEPTOR,
      useClass: RavenInterceptor({
        filters: [{
          type: HttpException, filter: (exception: HttpException) => 500 > exception.getStatus(),
        }],
      }),
    },
  ],
})
export class ApplicationModule implements NestModule {

  public configure(consumer: MiddlewareConsumer): void {
    // We apply AuthMiddleware globally and then set access right with guards.
    consumer.apply(AuthMiddleware)
    .forRoutes('*');
  }
}
github mentos1386 / nest-raven / test / test-project / src / app.controller.ts View on Github external
import { Controller, Get, UseInterceptors } from '@nestjs/common';
import { AppService } from './app.service';
import { RavenInterceptor } from 'nest-raven';

@Controller()
@UseInterceptors(new RavenInterceptor())
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Get()
  getHello(): string {
    return this.appService.getHello();
  }
}

nest-raven

Sentry Raven Module for Nest Framework

MIT
Latest version published 5 months ago

Package Health Score

78 / 100
Full package analysis