Yes. This has been discussed numerous time previously here in the forum, and also in many articles by The Building Coder on Detecting and Handling Dialogues and Failures:
One way to find previous answers to that here in the forum is to search for "dismiss"; I just tested it, with many good results.
Please always search for existing answers before raising a new question.