3 Replies Latest reply on May 10, 2007 11:25 AM by Denis

    exception action

    Denis Newbie

      The exception handling in pages.xml is excellent

      <exception class="java.lang.Throwable">
       <redirect>
       <message severity="warn">#{m.exception_general}</message>
       </redirect>
      </exception>
      


      Is there any way I can extend this "catch all" handler to execute an action e.g. e-mail an administrator?

        • 1. Re: exception action
          Christian Bauer Master

          You could redirect to a page with a page action.

          • 2. Re: exception action
            Christian Bauer Master

            Note that pages defined in pages.xml don't have to be real pages, you can use the render element inside a page element to render something else than the name specified.

            • 3. Re: exception action
              Denis Newbie

              Works, thanks.

              <!-- Catch all exception handler -->
              <exception class="java.lang.Throwable">
               <redirect view-id="/notify.xhtml">
               <message severity="warn">#{m.exception_general}</message>
               </redirect>
              </exception>
              
              <!-- notify the administrator that an exception has occurred -->
              <page view-id="/notify.xhtml" action="#{exceptionNotificationService.send}">
               <navigation>
               <redirect view-id="/error.xhtml" />
               </navigation>
              </page>
              
              Use Contexts.getConversationContext().get("org.jboss.seam.handledException") to get the exception in ExceptionNotificationService.send()