Skip to content

Commit

Permalink
Merge pull request #9 from restify/yunong/fixerr
Browse files Browse the repository at this point in the history
use cause and not err when instantiating verrors
  • Loading branch information
yunong committed Dec 21, 2016
2 parents a75af25 + 6ddb105 commit 44ef73a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function install(opts, cb) {
function (err, data) {
if (err) {
return cb1(new verror.VError({
err: err,
cause: err,
info: {
route: routeName,
method: method,
Expand All @@ -66,7 +66,7 @@ function install(opts, cb) {
};
} catch (e) {
return cb1(new verror.VError({
err: e,
cause: e,
info: {
func: data,
route: routeName,
Expand Down
4 changes: 2 additions & 2 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function parse(opts, cb) {
fs.readFile(opts.configPath, 'utf8', function (err, config) {
if (err) {
cb1(new verror.VError({
err: err,
cause: err,
info: {
fileName: opts.configPath
}
Expand All @@ -80,7 +80,7 @@ function parse(opts, cb) {
cb1();
} catch (e) {
cb1(new verror.VError({
err: err,
cause: err,
info: {
fileName: opts.configPath,
fileContents: config
Expand Down
3 changes: 3 additions & 0 deletions test/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ describe('enroute-install', function () {
} catch (exception) {
assert.isNotNull(exception, 'Exception should exist');
assert.equal(exception.actual, 'must specify opts.basePath');
assert.isOk(exception.stack);
done();
}
});
Expand All @@ -115,6 +116,7 @@ describe('enroute-install', function () {
basePath: BASEPATH
}, function (err) {
assert.isOk(err);
assert.isOk(err.stack);
return done();
});
});
Expand All @@ -130,6 +132,7 @@ describe('enroute-install', function () {
basePath: BASEPATH
}, function (err) {
assert.isOk(err);
assert.isOk(err.stack);
return done();
});

Expand Down

0 comments on commit 44ef73a

Please sign in to comment.