Skip to content

Commit

Permalink
New: Add nothrow option
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Kellen authored and phated committed Jan 4, 2019
1 parent 7d3384a commit 0ebc2d9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const extension = require('./lib/extension');
const normalize = require('./lib/normalize');
const register = require('./lib/register');

exports.prepare = function (extensions, filepath, cwd) {
exports.prepare = function (extensions, filepath, cwd, nothrow) {
var option, attempt;
var attempts = [];
var err;
Expand Down Expand Up @@ -45,7 +45,11 @@ exports.prepare = function (extensions, filepath, cwd) {
if (onlyErrors) {
err = new Error('Unable to use specified module loaders for "'+ext+'".');
err.failures = attempts;
throw err;
if (nothrow) {
return err;
} else {
throw err;
}
}
return attempts;
};

0 comments on commit 0ebc2d9

Please sign in to comment.