record_unwind_protect error handling