How to stop the simulation only when specific errors occur

In reply to saritr:

On which value you are setting UVM_MAX_QUIT_COUNT?
In case of a fatal the simulation stops immidiately