在我的Grails應用程序,我已經定義了以下(簡體)網頁流量Grails的流量異常處理
def registerFlow = {
start {
action {RegistrationCommand cmd ->
try {
memberService.validateRegistrationCommandDTO(cmd)
} catch (MemberException ex) {
flow.regErrorCode = ex.errorCode
throw ex
}
}
on("success").to "survey" // The 'survey' state has been omitted
on(MemberException).to "handleRegMemberException"
on(Exception).to "handleUnexpectedException"
}
handleRegMemberException {
action {
// Implementation omitted
}
}
handleUnexpectedException {
redirect(controller:'error', action:'serverError')
}
}
如果MemberException拋出的「啓動」狀態,執行應該進入「handleRegMemberException」狀態,但事實並非如此。我的流程定義有什麼問題,或者我對這種方式的理解如何?
謝謝, 唐