Skip to content

Commit 78a85de

Browse files
committed
fixup! rewrite ctx.get as async function
1 parent 5c9496f commit 78a85de

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

packages/context/src/context.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,23 +250,19 @@ export class Context {
250250
): Promise<T | undefined>;
251251

252252
// Implementation
253-
get<T>(
253+
async get<T>(
254254
keyWithPath: string,
255255
optionsOrSession?: ResolutionOptions | ResolutionSession,
256256
): Promise<T | undefined> {
257257
/* istanbul ignore if */
258258
if (debug.enabled) {
259259
debug('Resolving binding: %s', keyWithPath);
260260
}
261-
try {
262-
const valueOrPromiseLike = this.getValueOrPromise<T>(
263-
keyWithPath,
264-
optionsOrSession,
265-
);
266-
return Promise.resolve<T | undefined>(valueOrPromiseLike);
267-
} catch (err) {
268-
return Promise.reject(err);
269-
}
261+
262+
return await this.getValueOrPromise<T | undefined>(
263+
keyWithPath,
264+
optionsOrSession,
265+
);
270266
}
271267

272268
/**

0 commit comments

Comments
 (0)