You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

nestjs-bugsnag

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-bugsnag - npm Package Compare versions

Comparing version

to
0.1.0

2

package.json
{
"name": "nestjs-bugsnag",
"version": "0.0.7",
"version": "0.1.0",
"description": "A bugsnag library wrapper for nestjs",

@@ -5,0 +5,0 @@ "author": "dcampagnola",

@@ -41,2 +41,3 @@ <p align="center">

import { BugsnagModule } from 'nestjs-bugsnag';
import BugsnagPluginExpress from '@bugsnag/plugin-express'

@@ -49,2 +50,3 @@ @Module({

appVersion: '1.0.0',
plugins: [BugsnagPluginExpress],
notifyReleaseStages: ['production'],

@@ -60,3 +62,49 @@ onUncaughtException: true,

You can add the `BugsnagPluginExpress` to your `plugins` array in the `forRoot` method.
You can also use the `forRootAsync` method to configure the module:
```typescript
import { Module } from '@nestjs/common';
import { BugsnagModule } from 'nestjs-bugsnag';
import { ConfigModule } from '@nestjs/config';
@Module({
imports: [
ConfigModule.forRoot({
...
}),
BugsnagModule.forRootAsync({
inject: [ConfigModule],
useFactory: (configService: ConfigService) => ({
apiKey: configService.get('BUGSNAG_API_KEY'),
releaseStage: configService.get('BUGSNAG_RELEASE_STAGE'),
appVersion: configService.get('BUGSNAG_APP_VERSION'),
notifyReleaseStages: configService.get('BUGSNAG_NOTIFY_RELEASE_STAGES'),
onUncaughtException: configService.get('BUGSNAG_ON_UNCAUGHT_EXCEPTION'),
onUnhandledRejection: configService.get('BUGSNAG_ON_UNHANDLED_REJECTION'),
}),
}),
],
})
```
More options are found in [Bugsnag docs](https://docs.bugsnag.com/platforms/javascript/configuration-options/)
You can inject the `BugsnagService` to use it in your application:
```typescript
import { BugsnagService } from 'nestjs-bugsnag';
@Controller()
export class AppController {
constructor(private readonly bugsnagService: BugsnagService) {
}
failingMethod() {
this.bugsnagService.notify(new Error('Something went wrong'));
}
}
```