Refactor handle_update_fail_htlc to wrapper error handling function