6 Replies Latest reply on Oct 26, 2007 9:31 AM by adamw

    Exceptions in page param converters

    adamw

      Hello,

      I have an @ApplicationException, which I want to handle with Seam.
      In particular, I want to convert a page parameter to an entity, and if the page parameter points to a non-existing entity, an exception is thrown.

      The exception is defined as follows:

      <exception class="item.ItemNotFoundException">
       <redirect view-id="/error.xhtml">
       <message severity="ERROR">The item was not found.</message>
       </redirect>
      </exception>
      


      If I do:
      <page view-id="/item/item_view.xhtml" action="#{itemView.loadItem}">
       <param name="name" value="#{itemView.itemName}" />
      </page>
      

      and the "#{itemView.loadItem}" method throws an exception, the browser redirects to /error.xhtml, and the message is displayed.

      But if I do:
      <page view-id="/item/item_edit.xhtml">
       <param name="name" value="#{itemEdit.item}" converter="#{itemConverter}" />
      </page>
      

      and the converter throws an excpetion, the browser still redirects to /error.xhtml, but the message is not displayed. How can I change that? Obviously, conversion happens at an earlier phase than rendering the response, so the exception can be caught (and is :) ), but maybe I don't see the message because the conversation context isn't yet created?