remove redundant try-catch

pull/969/head
Rich Harris 8 years ago
parent 953c2967f2
commit 35085839e1

@ -69,28 +69,16 @@ async function _doPreprocess(source, type: 'script' | 'style', preprocessor: Pre
export async function preprocess(source: string, options: PreprocessOptions) { export async function preprocess(source: string, options: PreprocessOptions) {
const { markup, style, script } = options; const { markup, style, script } = options;
if (!!markup) { if (!!markup) {
try { const processed: { code: string, map?: SourceMap | string } = await markup({ content: source });
const processed: { code: string, map?: SourceMap | string } = await markup({ content: source }); source = processed.code;
source = processed.code;
} catch (error) {
defaultOnerror(error);
}
} }
if (!!style) { if (!!style) {
try { source = await _doPreprocess(source, 'style', style);
source = await _doPreprocess(source, 'style', style);
} catch (error) {
defaultOnerror(error);
}
} }
if (!!script) { if (!!script) {
try { source = await _doPreprocess(source, 'script', script);
source = await _doPreprocess(source, 'script', script);
} catch (error) {
defaultOnerror(error);
}
} }
return { return {

Loading…
Cancel
Save