1 Reply Latest reply on Apr 9, 2009 6:11 AM by Arbi Sookazian

    Exception handling in @create method

    lionel meroni Newbie

      hello,


      I have a backing bean with a @create method, like this :



      public class MyBean {
           
          @create
          public void init() throws BusinessException {
      
               // Some stuff throwing BusinessException here
          }
      
          public void anotherMethod() throws BusinessException {
      
               // Some stuff throwing BusinessException here
          }
      }




      And in page.xml I have something like this :



      <exception class="foo.bar.BusinessException" log-level="error">
              <redirect view-id="/error.xhtml">
                  <message severity="error">
                       #{org.jboss.seam.handledException.message}
                  </message>
              </redirect>
          </exception>



      It work fine if the exception BusinessException is thrown into anotherMethod. But not in the @create annoted method because the exception is wrapped into a RuntimeException and a InstantiationException. So the exception is not handle as i want, and there is no redirect...


      How should I do to handle exception in a @ create method ?