How to clear grid component after error on dataprovider methods

I used Vaadin 8. I created very simply view consists of table(grid) and textfield “Filter” and “Apply” button.
The grid is filled by lazy way through the callback data provider.
That means I implemented two methods in order to fetch partial data and get count of rows.
Further I set custom error handler on UI level that only shows error dialog where something wrong.

My problem is following:

  • user writes incorrect filter query
  • count method crashes, for instance SQLException
  • I would like to clear grid together with my error dialog.

Is possible to do something like this?