Skip to content

Commit

Permalink
refactor: remove error catching in CliBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
lsndr committed Oct 26, 2023
1 parent 1763f02 commit a2e696c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/Config/CliBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ClusterArgs, Helpers, logger, LogLevel, Sentry } from '../Utils';
import { SystemConfigManager } from './SystemConfigManager';
import { CliInfo } from './CliInfo';
import { Arguments, Argv, CommandModule } from 'yargs';
import { captureException } from '@sentry/node';

export interface CliBuilderOptions {
info: CliInfo;
Expand Down Expand Up @@ -109,21 +108,15 @@ export class CliBuilder {
const systemConfigManager = new SystemConfigManager(args.api as string);
const systemConfig = await systemConfigManager.read();

return Sentry.runWithAsyncContext(async () => {
return Sentry.runWithAsyncContext(() => {
this.initSentry(systemConfig.sentryDsn);
Sentry.setContext('args', args);

systemConfigManager.enableBackgroundRotation((rotatedSystemConfig) => {
this.initSentry(rotatedSystemConfig.sentryDsn);
});

try {
return await Promise.resolve(handler(args));
} catch (e) {
captureException(e);

throw e;
}
return handler(args);
});
};

Expand Down

0 comments on commit a2e696c

Please sign in to comment.