Skip to main content
2 of 2
formatting
Bharat Mane
  • 6.8k
  • 11
  • 41
  • 69

Use the keyword throw inside the catch block to stop the script from further execution, upon any failure/exception.

try
{
//code to test
}
catch (Exception e)
{
throw new AssertionError("A clear description of the failure", e);
}