Skip to content

Commit

Permalink
fix(preprocessor): better errors when loading preprocessors
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtajina committed Jun 28, 2013
1 parent 504e848 commit 3390a00
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
};

Expand Down

0 comments on commit 3390a00

Please sign in to comment.