If we have a few of subscribers and one of those throws an exception, our thread of execution well be interrupted.
For example:
var hub = new Mediator();
hub.on('test', function func1() { console.log(1); });
hub.on('test', function func2() { throw new Error('test error'); });
hub.on('test', function func3() { console.log(3); });
hub.trigger('test');
console.log(4);
Actual result:
Expected result:
1
3
4
and throwing exception with stacktrace