feature(core): allow custom local scripts to trigger on uncaught exceptions

https://github.com/Elgg/Elgg/issues/6586