cli-lib's `extract` function ignores `throws` setting for errors in `processFile`
TNick opened this issue · comments
Nicu Tofan commented
try {
const source = await readFile(fn, 'utf8')
return processFile(source, fn, opts)
} catch (e) {
if (throws) {
throw e
} else {
warn(String(e))
}
}
In this code exceptions thrown in processFile
will not be caught because processFile
is an async function.
Is this the intention or is it a bug?
try {
const source = await readFile(fn, 'utf8')
return Promise.resolve(await processFile(source, fn, opts));
} catch (e) {
if (throws) {
throw e
} else {
warn(String(e))
}
}