How to handle all errors in one place?

I am gettin pretty tired of catching and handling errors in every method call:'something', err => if(err) snackBar(err.reason)

Can i just write something like this?:

window.onerror = function (errorMsg) {

Problem is this code does not work. When i throw this kind of errors:

throw new Meteor.Error('not-authorized')

nothing is happenning.