When using unconcattenated JS, websites can continue to function if a single script has an error. If now these scripts are concattenated, it can result in very random errors (and this makes this especially hard to debug!) because not only the single script is not fully executed but all other scripts in the same concattenated JS file (see for example Automattic/jetpack#18187).
So I had this idea that we could wrap the since JS scripts in try { ... } catch (e) {} constructs. So instead of this:
we'd have
try{ script1 } catch (e); try{ script2 } catch (e);try{ script3 } catch (e);
If now an error occurs in the script while executing it, it won't bring the whole cascade down but would drop out of the single try...catch block, thus not causing more failure.
When using unconcattenated JS, websites can continue to function if a single script has an error. If now these scripts are concattenated, it can result in very random errors (and this makes this especially hard to debug!) because not only the single script is not fully executed but all other scripts in the same concattenated JS file (see for example Automattic/jetpack#18187).
So I had this idea that we could wrap the since JS scripts in
try { ... } catch (e) {}constructs. So instead of this:we'd have
If now an error occurs in the script while executing it, it won't bring the whole cascade down but would drop out of the single try...catch block, thus not causing more failure.