Skip to content

Commit b1b6e99

Browse files
Copilothotlong
andcommitted
style: add descriptive comments to catch blocks per code review feedback
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 8140bc3 commit b1b6e99

8 files changed

Lines changed: 10 additions & 3 deletions

File tree

packages/adapters/express/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export function createExpressRouter(options: ExpressAdapterOptions): Router {
9090
authService = options.kernel.getService<AuthService>('auth');
9191
}
9292
} catch {
93+
// Service not registered — fall through to dispatcher
9394
authService = null;
9495
}
9596

packages/adapters/fastify/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export async function objectStackPlugin(fastify: FastifyInstance, options: Fasti
9393
authService = options.kernel.getService<AuthService>('auth');
9494
}
9595
} catch {
96+
// Service not registered — fall through to dispatcher
9697
authService = null;
9798
}
9899

packages/adapters/hono/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export function createHonoApp(options: ObjectStackHonoOptions): Hono {
9696
authService = options.kernel.getService<AuthService>('auth');
9797
}
9898
} catch {
99+
// Service not registered — fall through to dispatcher
99100
authService = null;
100101
}
101102

packages/adapters/nestjs/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export class ObjectStackController {
123123
authService = kernel.getService<AuthService>('auth');
124124
}
125125
} catch {
126+
// Service not registered — fall through to legacy dispatcher
126127
authService = null;
127128
}
128129

packages/adapters/nextjs/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export function createRouteHandler(options: NextAdapterOptions) {
7777
authService = options.kernel.getService<AuthService>('auth');
7878
}
7979
} catch {
80+
// Service not registered — fall through to dispatcher
8081
authService = null;
8182
}
8283

packages/adapters/nuxt/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export function createH3Router(options: NuxtAdapterOptions): Router {
113113
authService = options.kernel.getService<AuthService>('auth');
114114
}
115115
} catch {
116+
// Service not registered — fall through to dispatcher
116117
authService = null;
117118
}
118119

packages/adapters/sveltekit/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export function createRequestHandler(options: SvelteKitAdapterOptions) {
117117
authService = options.kernel.getService<AuthService>('auth');
118118
}
119119
} catch {
120+
// Service not registered — fall through to dispatcher
120121
authService = null;
121122
}
122123

packages/runtime/src/http-dispatcher.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,14 +857,14 @@ export class HttpDispatcher {
857857
try {
858858
return await this.kernel.getServiceAsync(name);
859859
} catch {
860-
// Fall through to sync/map lookup
860+
// Service not registered or async resolution failed — fall through to sync/map lookup
861861
}
862862
}
863863
if (typeof this.kernel.getService === 'function') {
864864
try {
865865
return await this.kernel.getService(name);
866866
} catch {
867-
// Fall through to map lookup
867+
// Service not registered or sync resolution threw "is async" — fall through to map lookup
868868
}
869869
}
870870
const services = this.getServicesMap();
@@ -881,7 +881,7 @@ export class HttpDispatcher {
881881
try {
882882
const svc = await this.kernel.getServiceAsync('objectql');
883883
if (svc?.registry) return svc;
884-
} catch { /* ignore */ }
884+
} catch { /* service not registered or not yet available */ }
885885
}
886886
// 2. Try via kernel.getService (sync fallback)
887887
if (typeof this.kernel.getService === 'function') {

0 commit comments

Comments
 (0)