How to stop the simulation only when specific errors occur

In reply to saritr:

Youz have 2 options:
(1) from the CLI (command line interface) you can issue:
+UVM_MAX_QUIT_COUNT=10
(2) from your test you can call
set_report_max_quit_count(10).

In both cases the simulation will stop after 10 errors.