Refactor handle_update_fail_malformed_htlc to wrapper error handling function