Custom error message and restart the app

Hi all,

I am using gradio for demo a Q&A app created using GPT 3.0 Turbo and langchain.
If there is some sort of error, I want a custom error message in the error popup box (see attachment) with all the blocks cleared. By closing the error popup box, user should be able to continue with next question.

Tried "raise gr.Error(“Custom message”)
giving me message on the console. Need same message in the error box.

Any help will be appreciated.