Using:
<script> <!-- function test() { random-shizzle(); } try { test(); } catch (e) { alert('it broke!'); } //--> </script>