Skip to content

Commit bb22711

Browse files
committed
fix linting, improve comments
1 parent 6c3a37f commit bb22711

3 files changed

Lines changed: 23 additions & 8 deletions

File tree

‎packages/core/src/integrations/express/index.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ export function expressErrorHandler(options?: ExpressHandlerOptions): ExpressErr
223223
): void {
224224
// When an error happens, the `expressRequestHandler` middleware does not run, so we set it here too
225225
setSDKProcessingMetadata(request);
226-
// oxlint-disable-next-line typescript/no-deprecated
227226
const shouldHandleError =
227+
// oxlint-disable-next-line typescript/no-deprecated
228228
options?.shouldHandleError ?? getIntegrationShouldHandleError() ?? defaultShouldHandleError;
229229

230230
if (shouldHandleError === false) {
@@ -249,8 +249,7 @@ export function expressErrorHandler(options?: ExpressHandlerOptions): ExpressErr
249249
* The error handler must be before any other middleware and after all controllers.
250250
*
251251
* @param app The Express instances
252-
* @param options {ExpressHandlerOptions} Configuration options for the handler. Deprecated: set
253-
* `shouldHandleError` on `expressIntegration()` instead. This parameter will be removed in v11.
252+
* @param options {ExpressHandlerOptions} Configuration options for the handler
254253
*
255254
* @example
256255
* ```javascript

‎packages/core/src/integrations/express/types.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,22 @@ export interface ExpressHandlerOptions {
228228
*
229229
* @param error Captured middleware error
230230
*
231-
* @deprecated Set `shouldHandleError` on `expressIntegration()` instead. This option will be removed in v11.
231+
* @deprecated Configure `shouldHandleError` on `expressIntegration()` rather than here. Keep calling
232+
* `setupExpressErrorHandler(app)` as that is what captures the errors. This option will be removed in v11.
233+
*
234+
* @example
235+
*
236+
* ```javascript
237+
* Sentry.init({
238+
* integrations: [
239+
* Sentry.expressIntegration({
240+
* shouldHandleError(error) {
241+
* return (error.statusCode ?? 500) >= 500;
242+
* },
243+
* }),
244+
* ],
245+
* });
246+
* ```
232247
*/
233248
shouldHandleError?(this: void, error: MiddlewareError): boolean;
234249
}

‎packages/node/src/integrations/tracing/fastify/index.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ interface FastifyHandlerOptions {
7777
* @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)
7878
* @param reply Fastify reply (or any object containing at least statusCode)
7979
*
80-
* @deprecated Set `shouldHandleError` on `fastifyIntegration()` instead. It applies to every supported
81-
* Fastify version. This option will be removed in v11.
80+
* @deprecated Configure `shouldHandleError` on `fastifyIntegration()` rather than here, where it
81+
* applies to every supported Fastify version. This option will be removed in v11.
82+
*
83+
* @example
8284
*
8385
* ```javascript
8486
* Sentry.init({
@@ -145,8 +147,7 @@ export const fastifyIntegration = defineIntegration((options: Partial<FastifyInt
145147
* Add an Fastify error handler to capture errors to Sentry.
146148
*
147149
* @param fastify The Fastify instance to which to add the error handler
148-
* @param options Configuration options for the handler. Deprecated: set `shouldHandleError` on
149-
* `fastifyIntegration()` instead. This parameter will be removed in v11.
150+
* @param options Configuration options for the handler
150151
*
151152
* @example
152153
* ```javascript

0 commit comments

Comments
 (0)