enhance auto(…) to detect missing dependencies #263

Closed
RubyTuesdayDONO opened this Issue Mar 9, 2013 · 2 comments

Comments

Projects
None yet
3 participants
Contributor

RubyTuesdayDONO commented Mar 9, 2013

i'm not sure whether this is by design or not, but it would aid troubleshooting if auto(…) could (optionally?) detect when one of its tasks has unsatisfied dependencies. although developers should certainly be careful, it would be so helpful if auto(…) were to call out something like, task 'unreachable' has unsatisfied dependency on task 'nonexistent'.

var async = require('async'); 
async.auto({ 
    unreachable: [ 'nonexistent', function(callback) { 
        console.log('this message will not appear'); 
        callback(); 
    } ] 
}, function(err,res) { 
    if(err) { 
        console.dir(err); 
        process.exit(1); 
    } else { 
        process.exit(0); 
    } 
} 
Contributor

brianmaissy commented Mar 10, 2013

The simple case of a nonexistent dependency should definitely be implemented, since it costs almost nothing and would solve a common programmer error. To find loops in the dependencies would also be possible, but would take some extra processing. Still not a bad idea I think.

Obviously beyond that there's nothing much we can do.

Contributor

RubyTuesdayDONO commented Mar 10, 2013

dependency cycles could either throw an error or be converted into equal siblings with no children … better to throw an error in my use-cases (and probably simpler), although there are applications for everything :p

@caolan caolan closed this Mar 28, 2014

@bengourley bengourley referenced this issue in microadam/component-loader Aug 13, 2014

Closed

Doesn't fail if a dependency is not loaded #1

Mickael-van-der-Beek pushed a commit to Mickael-van-der-Beek/async that referenced this issue Nov 18, 2014

Mickael-van-der-Beek pushed a commit to Mickael-van-der-Beek/async that referenced this issue Nov 18, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment