How to implement following case failure handlling requirement?

In a case(case tag is must),

  1. some steps are critical steps, if these steps failure, case will be set failure status and stop execution.
    2)some other steps are non critical steps,if these steps failure, case will be set as failure and continue execution. How to implement this requirement.
    I add a test listener method like following, implement 1) requirement, but for 2) requirement, I don’t konw how to implement. Anybody know how to implement 2)?

class NewTestListener {
/**
* Executes after every test case ends.
* @param testCaseContext related information of the executed test case.
*/
@AfterTestCase
def sampleAfterTestCase(TestCaseContext testCaseContext) {
println testCaseContext.getTestCaseId()
String case_status = testCaseContext.getTestCaseStatus()
TestCase testCase = TestCaseFactory.findTestCase(testCaseContext.getTestCaseId());
String case_tag = testCase.getTag()
println(case_tag)
//Thread.sleep(1500)
try{
if (case_tag == ‘must’ && case_status == ‘FAILED’ ){
KeywordUtil.logInfo(‘重要用例“’+testCaseContext.getTestCaseId()+‘”失败,导致该次测试停止’)
System.exit(0)
}else{
}
}catch(Exception e){
println (e)
e.printStackTrace()
}
println (‘我是测试监听里的log’)
}
}

I try to set non critical steps failure handling as Optional, but this error happen, case status will be set warning status, in execution report, can’t find there case failure info.