Skip to content

catch e, but return err #64

@pmelisko

Description

@pmelisko

In fileAnalyze function (lib/require-analyzer.js) there is bug, if there is something wrong in detective.find (i.e. es6/7 features in my case) a get empty result. It is caused by calling callback with null (err instead of e, see that second callback in code below)

fs.readFile(options.target, function(err, data){
    if(err) return callback(err);

    var files;

    try {
      files = detective.find(data.toString('utf8'));
    } catch(e){
      return callback(err);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions