Refactored _onUncaughtException to remove knowledge of StateMachine.
Template method pattern woooo.