Tie thread exception state into exception handlers