You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -85,11 +78,11 @@ import { AppService } from "./app.service";
85
78
exportclassAppModule {}
86
79
```
87
80
88
-
#### Exception Handling
81
+
#### Exception handling
89
82
90
83
If you're using a global catch-all exception filter (which is either a filter registered with `app.useGlobalFilters()` or a filter registered in your app module providers annotated with a `@Catch()` decorator without arguments), add a `@SentryExceptionCaptured()` decorator to the filter's `catch()` method. This decorator will report all unexpected errors that are received by your global error filter to Sentry:
@@ -104,15 +97,15 @@ export class YourCatchAllExceptionFilter implements ExceptionFilter {
104
97
105
98
By default, only unhandled exceptions that are not caught by an error filter are reported to Sentry. `HttpExceptions` (including [derivatives](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)) are also not captured by default because they mostly act as control flow vehicles.
106
99
107
-
If you don't have a global catch-all exception filter, add the `SentryGlobalFilter` to the providers of your main module. This filter will report any unhandled errors that aren't caught by other error filters to Sentry.
100
+
If you don't have a global catch-all exception filter, add the `SentryGlobalFilter` to the providers of your main module. This filter will report any unhandled errors that aren't caught by other error filters to Sentry.
108
101
109
-
> warning **Important** The `SentryGlobalFilter` needs to be registered before any other exception filters.
102
+
> warning **Warning** The `SentryGlobalFilter` needs to be registered before any other exception filters.
@@ -126,7 +119,7 @@ import { APP_FILTER } from "@nestjs/core";
126
119
exportclassAppModule {}
127
120
```
128
121
129
-
#### Add Readable Stack Traces to Errors
122
+
#### Readable stack traces
130
123
131
124
Depending on how you've set up your project, the stack traces in your Sentry errors probably won't look like your actual code.
132
125
@@ -136,22 +129,19 @@ To fix this, upload your source maps to Sentry. The easiest way to do this is by
136
129
npx @sentry/wizard@latest -i sourcemaps
137
130
```
138
131
139
-
140
-
#### Testing the Integration
132
+
#### Testing the integration
141
133
142
134
To verify your Sentry integration is working, you can add a test endpoint that throws an error:
143
135
144
136
```typescript
145
-
@Get("/debug-sentry")
137
+
@Get("debug-sentry")
146
138
getError() {
147
139
thrownewError("My first Sentry error!");
148
140
}
149
-
150
141
```
151
142
152
143
Visit `/debug-sentry` in your application, and you should see the error appear in your Sentry dashboard.
153
144
154
-
155
145
### Summary
156
146
157
147
For complete documentation about Sentry's NestJS SDK, including advanced configuration options and features, visit the [official Sentry documentation](https://docs.sentry.io/platforms/javascript/guides/nestjs/).
0 commit comments