Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions lib/protos.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,9 @@ exports.invoke = function(method) {
if (!this[method]) return;
var args = Array.prototype.slice.call(arguments, 1);
if (!this._ready) return this.queue(method, args);
var ret;

try {
this.debug('%s with %o', method, args);
ret = this[method].apply(this, args);
} catch (e) {
this.debug('error %o calling %s with %o', e, method, args);
}

return ret;
this.debug('%s with %o', method, args);
return this[method].apply(this, args);
};

/**
Expand Down
6 changes: 4 additions & 2 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,12 @@ describe('integration', function() {
assert(integration.track.calledWith('event'));
});

it('should catch errors when it calls', function() {
it('should throw errors if the integration errors', function() {
integration.emit('ready');
integration.initialize();
integration.invoke('page', 'name');
assert['throws'](function() {
integration.invoke('page', 'name');
}, Error, 'Should not swallow exceptions');
});

it('should return the returned value', function(done) {
Expand Down