From 8bc6986cacb7c5d64c62aef0dd801cb0b99daa4a Mon Sep 17 00:00:00 2001 From: eight Date: Tue, 12 Sep 2017 00:08:54 +0800 Subject: [PATCH] Change: make unknown preprocessor throw --- js/usercss.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/usercss.js b/js/usercss.js index 7c5835b0..5099e8b0 100644 --- a/js/usercss.js +++ b/js/usercss.js @@ -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;