1 Reply Latest reply on Jul 17, 2009 3:41 AM by lanza

    Use Case Exceptions handling


      I think it would be interesting a new exceptions handling method: use case exceptions handling.

      Imagine this scenario: I've got a use case object that throws a Runtime exception when it fails:

          public void createNewAccount() {
              if(useIsVerySilly()) {
                   throw new UserIsVerySillyException();

      And UserIsVerySillyException:

      public class UserIsVerySillyException extends RuntimeException {

      I don't want pages.xml traps this exception. I want current page .pages.xml navigation files capture it, to show a beautiful bundled message on it.

      myusecasepage.page.xml should be:

           <exception class="org.test.UserIsVerySillyException">
                <redirect view-id="#{facesContext.externalContext.requestServletPath}">

      So, basically, to trap exceptions in the same page they are generated.