The function tagpro.ready that is widely used in userscripts doesn't catch errors. The problem: as soon as one function that is put into tagpro.ready( function ) throws an error, none of the functions that are added later are called back. Meaning that if one script throws an error inside a tagpro.ready callback, all scripts that are loaded later won't run, a bug which is very hard to catch.
1 line of code says more than a thousand words:
tagpro._readyCallbacks.forEach(function(e){e()});
should preferebly be
tagpro._readyCallbacks.forEach(function(e){
try{e()}
catch(error){console.error("Unhandled tagpro.ready() error. Mod makers, handle your errors!")}
});
The function
tagpro.ready
that is widely used in userscripts doesn't catch errors. The problem: as soon as one function that is put intotagpro.ready( function )
throws an error, none of the functions that are added later are called back. Meaning that if one script throws an error inside a tagpro.ready callback, all scripts that are loaded later won't run, a bug which is very hard to catch.1 line of code says more than a thousand words:
should preferebly be