Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
better compiler errors
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Feb 15, 2016
1 parent 37bcdb2 commit d72141b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ function compileLoad(loader, load, compileOpts, cache) {
if (format in compilerMap) {
if (format == 'cjs')
mappedLoad.source = mappedLoad.source.replace(hashBangRegEx, '');
return Promise.resolve(require(compilerMap[format]).compile(mappedLoad, compileOpts, loader))
return Promise.resolve()
.then(function() {
return require(compilerMap[format]).compile(mappedLoad, compileOpts, loader);
})
.then(function(output) {
// store compiled output in cache
cache.loads[load.name] = {
Expand All @@ -113,10 +116,13 @@ function compileLoad(loader, load, compileOpts, cache) {
};

return output;
}, function(err) {
})
.catch(function(err) {
// Traceur has a habit of throwing array errors
if (err instanceof Array)
throw err[0];
err = err[0];
err.message = 'Error compiling ' + format + ' module "' + load.name + '" at ' + load.path + '\n\t' + err.message;
throw err;
});
}

Expand Down

0 comments on commit d72141b

Please sign in to comment.