Skip to content

Commit

Permalink
Check config in build(..), and throw Error if config is bad
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Chien committed Feb 7, 2012
1 parent 15da8c9 commit 1383433
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,15 @@ var fs = require('fs'),
logger = require('./lib/logger'),
moduleGrapher = require('module-grapher');

function checkConfig(config) {
if (config.minify && config.cache) {
return 'Cannot minify code when using cache.';
}
return '';
}

exports.build = build;
function build(main, config, callback) {
if (!callback) {
callback = config;
config = {};
}
var configErr = checkConfig(config);
if (configErr) {
callback(configErr);
if (config.minify && config.cache) {
var err = new Error('Cannot minify code when using cache.');
callback(err);
return;
}
moduleGrapher.graph(main, config, function(err, result) {
Expand Down

0 comments on commit 1383433

Please sign in to comment.