Skip to content

Commit 8fd2182

Browse files
committed
fix(error hook): Error hook will only pass error object
Per @jhusain - we don't need to pass the path values because in some cases there won't be any and in most cases we've already logged those elsewhere. BREAKING CHANGE: error hook arguments have changes. Now only the error itself is passed, not the path information.
1 parent 816eccc commit 8fd2182

File tree

5 files changed

+4
-8
lines changed

5 files changed

+4
-8
lines changed

src/router/call.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@ module.exports = function routerCall(callPath, args,
7979
});
8080
})
8181
.do(null, function errorHookHandler(err) {
82-
router._errorHook(callPath, err);
82+
router._errorHook(err);
8383
}));
8484
};

src/run/conversion/noteToJsongOrPV.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function convertNoteToJsongOrPV(pathOrPathSet,
3737
incomingJSONGOrPathValues =
3838
errorToPathValue(note.error, pathOrPathSet);
3939

40-
routerInstance._errorHook(pathOrPathSet, note.error);
40+
routerInstance._errorHook(note.error);
4141
}
4242

4343
// If its jsong we may need to optionally attach the

test/unit/core/call.spec.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,7 @@ describe('Call', function() {
202202
call(['videos', 1234, 'rating'], [5]).
203203
do(noOp, function(err) {
204204
expect(callCount).to.equal(1);
205-
expect(callArgs).to.deep.equal([
206-
['videos', 1234, 'rating'],
207-
err
208-
]);
205+
expect(callArgs).to.deep.equal([err]);
209206
expect(callContext).to.equal(router);
210207
}).
211208
subscribe(noOp, doneOnError(done), errorOnCompleted(done));

test/unit/core/get.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,6 @@ describe('Get', function() {
722722
function () {
723723
expect(callCount).to.equal(1);
724724
expect(callArgs).to.deep.equal([
725-
['videos', 1, 'title'],
726725
new Error('bad luck for you')
727726
]);
728727
expect(callContext).to.equal(router);

test/unit/core/set.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ describe('Set', function() {
261261
})
262262
.do(function() {
263263
expect(errorHook.callCount).to.equal(1);
264-
expect(errorHook.calledWith(['im', 'a', 'route', 'yo'], new Error('error lawl'))).to.be.ok;
264+
expect(errorHook.calledWith(new Error('error lawl'))).to.be.ok;
265265
})
266266
.subscribe(noOp, done, done);
267267
});

0 commit comments

Comments
 (0)