Gavin, Im facing the same problem. Im using 1.2.1GA
The only difference is that Im throwing in the stateful bean a specific
exception I created...
| @ApplicationException(rollback=true)
| public class GeneralApplicationException extends RuntimeException {
|
| public GeneralApplicationException(String message) {
| super(message);
| }
| }
|
...and digging into the stack to get the messages with a class I also created
(ExceptionMessages):
| try {
| entityManager.persist(instance);
| entityManager.flush();
| } catch (RuntimeException e){
| throw new GeneralApplicationException(ExceptionMessages.getMessage(e));
| }
|
Then the message from my GeneralApplicationException is nicely presented in a
error page (fragment from pages.xml):
| <exception
class="com.sphere.consultoria.exceptions.GeneralApplicationException">
| <end-conversation/>
| <redirect view-id="/error.xhtml">
| <param name="icon" value="error_icon.gif"/>
| </redirect>
| </exception>
|
My goal would be not having to use my GeneralApplicationException at all, and
map every exception with their specific messages into pages.xml. Unfortunately,
that's not possible, because the best I can get is the
javax.persistence.PersistenceException or treat every else with a catch-all tag:
| <exception>
| <end-conversation/>
| <redirect view-id="/error.xhtml">
| <message>Ocorreu um erro inesperado. Se o problema persistir,
consulte o administrador do sistema.</message>
| <param name="icon" value="error_icon.gif"/>
| </redirect>
| </exception>
|
| <exception class="javax.persistence.PersistenceException">
| <end-conversation/>
| <redirect view-id="/error.xhtml">
| <message>Ocorreu um erro ao tentar persistir as informações no
banco de dados.</message>
| <param name="icon" value="error_icon.gif"/>
| </redirect>
| </exception>
|
It would be nice if I could map ContraintViolationException, for example, with
its specific message.
Is it possible? I can't find a solution on this... tried searching the forum
but only found similar posts...
Thanks for any help.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4036924#4036924
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4036924
_______________________________________________
jboss-user mailing list
[EMAIL PROTECTED]
https://lists.jboss.org/mailman/listinfo/jboss-user