From 6b3636d6dcf6b47323800ff507de413c57f33a38 Mon Sep 17 00:00:00 2001 From: Markus Wolf Date: Wed, 14 Dec 2016 14:01:30 +0100 Subject: [PATCH] fix: async error handling during file loading --- src/bundle.ts | 4 ++-- src/source-map.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bundle.ts b/src/bundle.ts index 92d8634..a4a0409 100644 --- a/src/bundle.ts +++ b/src/bundle.ts @@ -136,10 +136,10 @@ export function rebundleFactory(state: State, paeckchenAst: ESTree.Program, cont if (timer) { clearTimeout(timer); } - timer = setTimeout(() => { + timer = setTimeout(async () => { try { context.logger.trace('bundle', `rebundle`); - bundleFunction(state, paeckchenAst, context, outputFunction); + await bundleFunction(state, paeckchenAst, context, outputFunction); } catch (e) { outputFunction(e, context); } diff --git a/src/source-map.ts b/src/source-map.ts index ddb9815..cf02061 100644 --- a/src/source-map.ts +++ b/src/source-map.ts @@ -7,7 +7,7 @@ import { State } from './state'; async function readFiles(context: PaeckchenContext, files: string[], suffix: string): Promise<(string|undefined)[]> { return await Promise.all(files.map(async path => { try { - return context.host.readFile(`${path}${suffix}`); + return await context.host.readFile(`${path}${suffix}`); } catch (e) { return undefined; }