|
@@ -1,5 +1,4 @@
|
|
|
import { MiddlewareConsumer, NestModule } from '@nestjs/common';
|
|
import { MiddlewareConsumer, NestModule } from '@nestjs/common';
|
|
|
-import { APP_FILTER } from '@nestjs/core';
|
|
|
|
|
import { PluginCommonModule, VendurePlugin } from '@vendure/core';
|
|
import { PluginCommonModule, VendurePlugin } from '@vendure/core';
|
|
|
|
|
|
|
|
import { SentryAdminTestResolver } from './api/admin-test.resolver';
|
|
import { SentryAdminTestResolver } from './api/admin-test.resolver';
|
|
@@ -8,7 +7,7 @@ import { ErrorTestService } from './api/error-test.service';
|
|
|
import { SENTRY_PLUGIN_OPTIONS } from './constants';
|
|
import { SENTRY_PLUGIN_OPTIONS } from './constants';
|
|
|
import { SentryApolloPlugin } from './sentry-apollo-plugin';
|
|
import { SentryApolloPlugin } from './sentry-apollo-plugin';
|
|
|
import { SentryContextMiddleware } from './sentry-context.middleware';
|
|
import { SentryContextMiddleware } from './sentry-context.middleware';
|
|
|
-import { SentryExceptionsFilter } from './sentry.filter';
|
|
|
|
|
|
|
+import { SentryErrorHandlerStrategy } from './sentry-error-handler-strategy';
|
|
|
import { SentryService } from './sentry.service';
|
|
import { SentryService } from './sentry.service';
|
|
|
import { SentryPluginOptions } from './types';
|
|
import { SentryPluginOptions } from './types';
|
|
|
|
|
|
|
@@ -108,21 +107,14 @@ const SentryOptionsProvider = {
|
|
|
*/
|
|
*/
|
|
|
@VendurePlugin({
|
|
@VendurePlugin({
|
|
|
imports: [PluginCommonModule],
|
|
imports: [PluginCommonModule],
|
|
|
- providers: [
|
|
|
|
|
- SentryOptionsProvider,
|
|
|
|
|
- SentryService,
|
|
|
|
|
- ErrorTestService,
|
|
|
|
|
- {
|
|
|
|
|
- provide: APP_FILTER,
|
|
|
|
|
- useClass: SentryExceptionsFilter,
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ providers: [SentryOptionsProvider, SentryService, ErrorTestService],
|
|
|
configuration: config => {
|
|
configuration: config => {
|
|
|
config.apiOptions.apolloServerPlugins.push(
|
|
config.apiOptions.apolloServerPlugins.push(
|
|
|
new SentryApolloPlugin({
|
|
new SentryApolloPlugin({
|
|
|
enableTracing: !!SentryPlugin.options.enableTracing,
|
|
enableTracing: !!SentryPlugin.options.enableTracing,
|
|
|
}),
|
|
}),
|
|
|
);
|
|
);
|
|
|
|
|
+ config.systemOptions.errorHandlers.push(new SentryErrorHandlerStrategy());
|
|
|
return config;
|
|
return config;
|
|
|
},
|
|
},
|
|
|
adminApiExtensions: {
|
|
adminApiExtensions: {
|
|
@@ -130,7 +122,7 @@ const SentryOptionsProvider = {
|
|
|
resolvers: () => (SentryPlugin.options.includeErrorTestMutation ? [SentryAdminTestResolver] : []),
|
|
resolvers: () => (SentryPlugin.options.includeErrorTestMutation ? [SentryAdminTestResolver] : []),
|
|
|
},
|
|
},
|
|
|
exports: [SentryService],
|
|
exports: [SentryService],
|
|
|
- compatibility: '^2.0.0',
|
|
|
|
|
|
|
+ compatibility: '^2.2.0',
|
|
|
})
|
|
})
|
|
|
export class SentryPlugin implements NestModule {
|
|
export class SentryPlugin implements NestModule {
|
|
|
static options: SentryPluginOptions = {} as any;
|
|
static options: SentryPluginOptions = {} as any;
|