views:

18

answers:

1

I have a custom portlet made for liferay and sometimes it throws an exception. Why it throws exceptions is irrelevant.

How to catch exceptions thrown by portlet handler methods in order to email information about them? I know I could do try catching on every handler method but it would be a much more elegant and cleaner solution to catch the exception on a higher level and just email some information about the error.

I'm using Spring Portlet MVC, so i got all spring-related niceties at hand.

+1  A: 

Problem(s) solved.

Made a class that implements org.springframework.web.portlet.HandlerExceptionResolver and declared it in applicationContext.xml:

<bean id="myExeptionResolver" class="net.foo.bar.MyExeptionResolver" />

Spring picks the class up and magically knows what it's for.

For the emailing I used Liferay's MailEngine.

heikkim