Skip to content

Commit

Permalink
refactor(core,admin): remove catch clauses (#871)
Browse files Browse the repository at this point in the history
this is done so that initialization errors properly crash the core module,
since recovery is not possible at that stage
  • Loading branch information
kkopanidis authored Jan 3, 2024
1 parent 9b2c31c commit 2d7be12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 1 addition & 6 deletions packages/admin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,7 @@ export default class AdminModule extends IConduitAdmin {
patchRouteMiddlewares: this.patchRouteMiddlewares.bind(this),
},
);
this.grpcSdk
.waitForExistence('database')
.then(this.handleDatabase.bind(this))
.catch(e => {
ConduitGrpcSdk.Logger.error(e.message);
});
this.grpcSdk.waitForExistence('database').then(this.handleDatabase.bind(this));
}

async subscribeToBusEvents() {
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/GrpcServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export class GrpcServer {
private readonly server: ConduitGrpcServer;
private readonly events: EventEmitter;

constructor(private readonly commons: ConduitCommons, private readonly port: number) {
constructor(
private readonly commons: ConduitCommons,
private readonly port: number,
) {
this.events = new EventEmitter();
this.events.setMaxListeners(150);
this.server = new ConduitGrpcServer(this.port.toString());
Expand Down Expand Up @@ -99,10 +102,7 @@ export class GrpcServer {
this.initializeMetrics();
this._grpcSdk
.waitForExistence('database')
.then(() => this.commons.getConfigManager().registerAppConfig())
.catch(e => {
ConduitGrpcSdk.Logger.error(e.message);
});
.then(() => this.commons.getConfigManager().registerAppConfig());
await this.commons
.getConfigManager()
.configurePackage(
Expand Down

0 comments on commit 2d7be12

Please sign in to comment.