Add a debug_on function to allow for easy catching of errors in the debugger

This adds a utility function that lets us easily catch errors in the debugger. Especially helpful for intermittent failures, as you can just run multiple times with the function activated.