From 3390a00b49c513a6da60f48044462118436130f8 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Thu, 27 Jun 2013 18:52:47 -0700 Subject: [PATCH] fix(preprocessor): better errors when loading preprocessors --- lib/preprocessor.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/preprocessor.js b/lib/preprocessor.js index e64826d7b..40430ddfa 100644 --- a/lib/preprocessor.js +++ b/lib/preprocessor.js @@ -26,12 +26,17 @@ var createPreprocessor = function(config, basePath, injector) { preprocessors.shift()(content, file, nextPreprocessor); }; - var instantiatePreprocessor = function(preprocessorName) { + var instantiatePreprocessor = function(name) { try { - preprocessors.push(injector.get('preprocessor:' + preprocessorName)); + preprocessors.push(injector.get('preprocessor:' + name)); } catch (e) { // TODO(vojta): log warning only once per each preprocessor - log.warn('Pre-processor "%s" is not registered!', preprocessorName); + if (e.message.indexOf('No provider for "preprocessor:' + name + '"') !== -1) { + log.warn('Can not load "%s", it is not registered!\n ' + + 'Perhaps you are missing some plugin?', name); + } else { + log.warn('Can not load "%s"!\n ' + e.stack, name); + } } };