madvoc : best practices for exception handling

7 views
Skip to first unread message

moh....@googlemail.com

unread,
Nov 11, 2015, 8:10:46 AM11/11/15
to Jodders
Hi,

the next thing i struggle with : exception handling with madvoc.
I have read the madvoc documentation , but i have found nothing unfortunately - or i have skipped it :-(

What is your best practice for the topic "exception handling"?

#1
With madvoc interceptors?

#2
expanding common MadvocController?
such like :
MyController extends MadvocController {

public String invoke(String actionPath, HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws Exception {

   
try {
       
return super.invoke(....);
    
} catch (Throwable t) {
         
// delegate to custom method
         return
handleException (....);    
     }



     
protected String handleException (String actionPath, HttpServletRequest servletRequest, HttpServletResponse servletResponse, Exception e) {
          // custom exception handling - to be defined
     }


}


#3
totally another idea / suggestion




Thank you your any feedback!



Jodders

unread,
Nov 11, 2015, 3:16:50 PM11/11/15
to Jodders
Its up to you :)))

Using interceptors (#1) is totally valid - and I usually use that as well. With interceptors you can fine control the error handling etc directly in the annotations. Works well :) With interceptors you have also an option to continue the flow, if some exception can be 'swallowed'.

Madvoc controller can be used as well - although then you get one single place to control exceptions - which is totally fine as well :)

Since the whole logic is that simple: "controler -> filter -> action" these are the points where you can catch and handle exceptions :)

So once again - there is no special recommendation for this, you perfectly got it right ;)


On Wednesday, November 11, 2015 at 2:10:46 PM UTC+1, 
Reply all
Reply to author
Forward
0 new messages