clistview: only ajax update if returned data is valid

I’m using a ClistView to display some search results, the results come from an external search index.

In some rare cases, there is something wrong and no data is returned. In those cases I want the listview to keep it’s current state and not update using the (empty) data. Instead I want to show some sort of alert informing the user that there was something wrong with the request, and to try again.

What’s the easiest way to accomplish this? Can I check the data somehow before updating the listview?