Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { IntegrationFn } from '@sentry/core';
import { defineIntegration } from '@sentry/core';
import type { FastifyIntegration, FastifyReply, FastifyRequest } from './types';

import { instrumentFastify as _instrumentFastify } from './instrumentation';
import { defaultShouldHandleError, INTEGRATION_NAME } from './utils';
import { subscribeToFastifyErrorChannel, handleFastifyError as _handleFastifyError } from './errors';
Expand Down Expand Up @@ -41,7 +40,7 @@ interface FastifyIntegrationOptions {
shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;
}

const _fastifyIntegration = (({ shouldHandleError }: Partial<FastifyIntegrationOptions>) => {
const _fastifyIntegration = (({ shouldHandleError }: Partial<FastifyIntegrationOptions> = {}) => {
let _shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;

return {
Expand Down Expand Up @@ -76,9 +75,7 @@ const _fastifyIntegration = (({ shouldHandleError }: Partial<FastifyIntegrationO
* })
* ```
*/
export const fastifyIntegration = defineIntegration((options: Partial<FastifyIntegrationOptions> = {}) =>
_fastifyIntegration(options),
);
export const fastifyIntegration = defineIntegration(_fastifyIntegration);
Comment thread
cursor[bot] marked this conversation as resolved.

/**
* @deprecated This export is deprecated and will not longer be exposed in the next major version.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FastifyReply, FastifyRequest } from './types';

export const INTEGRATION_NAME = 'Fastify';
export const INTEGRATION_NAME = 'Fastify' as const;

/**
* Default function to determine if an error should be sent to Sentry
Expand Down
Loading