I encountered a similar problem in my project, where I used to get random fatal error dialogs.
The approach I followed is to handle the dialog in AfterStep hook. Since in cucumber every step is atomic, after every step I verify whether the fatal error dialog is present. If it is there then click OK and proceed with the execution.
Hope this helps for you.