Skip to content

Commit a0a3397

Browse files
committed
fixup! rewrite ctx.get as async function
1 parent 33ebade commit a0a3397

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
@@ -223,23 +223,19 @@ export class Context {
223223
): Promise<T | undefined>;
224224

225225
// Implementation
226-
get<T>(
226+
async get<T>(
227227
keyWithPath: string,
228228
optionsOrSession?: ResolutionOptions | ResolutionSession,
229229
): Promise<T | undefined> {
230230
/* istanbul ignore if */
231231
if (debug.enabled) {
232232
debug('Resolving binding: %s', keyWithPath);
233233
}
234-
try {
235-
const valueOrPromiseLike = this.getValueOrPromise<T>(
236-
keyWithPath,
237-
optionsOrSession,
238-
);
239-
return Promise.resolve<T | undefined>(valueOrPromiseLike);
240-
} catch (err) {
241-
return Promise.reject(err);
242-
}
234+
235+
return await this.getValueOrPromise<T | undefined>(
236+
keyWithPath,
237+
optionsOrSession,
238+
);
243239
}
244240

245241
/**

0 commit comments

Comments
 (0)