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.
def sampleAfterTestCase(TestCaseContext testCaseContext) {
println testCaseContext.getTestCaseId()
String case_status = testCaseContext.getTestCaseStatus()
TestCase testCase = TestCaseFactory.findTestCase(testCaseContext.getTestCaseId());
String case_tag = testCase.getTag()
if (case_tag == ‘must’ && case_status == ‘FAILED’ ){
}catch(Exception e){
println (e)
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.