fix: avoid syncronous errors in compile method

This commit is contained in:
calebboyd
2019-01-23 20:21:34 -06:00
parent 12c77a34fd
commit 1a75bdb058
8 changed files with 80 additions and 31 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { NexeCompiler } from '../compiler'
import { NexeCompiler, NexeError } from '../compiler'
import { resolve, relative } from 'path'
import { each } from '@calebboyd/semaphore'
import resolveFiles from 'resolve-dependencies'
@@ -48,7 +48,7 @@ export default async function bundle(compiler: NexeCompiler, next: any) {
if (
warnings.filter(x => x.startsWith('Error parsing file') && !x.includes('node_modules')).length
) {
throw new Error('Parsing Error:\n' + warnings.join('\n'))
throw new NexeError('Parsing Error:\n' + warnings.join('\n'))
}
await each(Object.keys(files), (filename: string) => compiler.addResource(filename), {