Set return_code on exception exits.