8 Replies Latest reply on Mar 19, 2009 1:23 PM by luxspes

    Despite Exception the code in component continues to execute

    arsenalist
      I'm trying to implement exception handling in Seam and from the docs I gather that I could do the following:

          <exception>
             <redirect view-id="/error.xhtml">
                 <message severity="ERROR">#{org.jboss.seam.handledException.message}</message>
             </redirect>
          </exception>  


      Here's the code in my UserAction component which makes a call to userManager to delete the user.  The effect I want to have is that on a successful deletion, the "user.delete.success" message gets displayed and on an exception, the #{org.jboss.seam.handledException.message} gets displayed. 

          public void delete() {
              log.debug("before");
              userManager.remove(user);
              facesMessages.addFromResourceBundle("user.delete.success");
              log.debug("after");
          }

      The behavior that I'm seeing in the logs on an exception is this:

      - before gets printed
      - after gets printed
      - exception is printed
      - both messages show up on the screen.

      I can't understand why anything after userManager.remove() is printed since it throws an exception.

      Any ideas as to what I'm doing wrong or how to go about solving this seemingly straightforward problem.

      Any help is appreciated.

      Thanks,
      Zarar