How to exit from simulation on getting UVM_ERROR

Depending on which shell you are using, you will have to escape the pipe operator.

with backslash
+uvm_set_action=uvm_test_top.,ALL,UVM_ERROR,UVM_DISPLAY|UVM_EXIT
with single quotes
'+uvm_set_action=uvm_test_top.
,ALL,UVM_ERROR,UVM_DISPLAY|UVM_EXIT’

You will probably have to remove the spaces within the command if the command line processor cannot deal with them.

You can also set the max quit count to 1, which has the makes the first error quit the simulation. +UVM_MAX_QUIT_COUNT=1