Change: make unknown preprocessor throw

This commit is contained in:
eight 2017-09-12 00:08:54 +08:00
parent cfdb0b4eeb
commit 8bc6986cac

View File

@ -203,7 +203,10 @@ var usercss = (function () {
function buildCode(style) {
let builder;
if (style.preprocessor && style.preprocessor in BUILDER) {
if (style.preprocessor) {
if (!BUILDER.hasOwnProperty(style.preprocessor)) {
return Promise.reject(new Error(`Unsupported preprocessor: ${style.preprocessor}`));
}
builder = BUILDER[style.preprocessor];
} else {
builder = BUILDER.default;