Want to stop simulation when i get a Error/warning

You will need to check you vendor’s user manual. In Questa, there is a SolveFailSeverity setting that can be changed to stop the simulation.