Re: Exception handling in Spring-MVC/FreeMarker web applications
"Newman, John W" <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <D688C4D318A63D4290AA94A33E06F7D2027BC1AF3E@msxmbxnsprd14.acct.upmchs.net> |
Now I remember.. the default was html debug I believe.. this shows the yellow trace in the browser, which is a good default for dev. I think a blurb about switching this for prod would be a good addition to the doco (an earlier part most people actually read). If you google for a few terms on that page a bit you'll find lots of people have apps in prod without this configured. =) So once I found this exists, I switched to rethrow, and now the error is caught by our exception handler bean upstream. This guy is configured through the stripes framework, I'd imagine spring MVC offers a similar exception handling facility. The handler gets the template exception, logs it (among other things), and then sends the user to our nice 500 page. This page has a piece in it to check if the app is running in debug mode, and if so it will render the trace nicely for the developer. -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: Wednesday, October 21, 2009 4:26 PM To: Daniel Dekany; FreeMarker-user Subject: Re: [FreeMarker-user] Exception handling in Spring-MVC/FreeMarker web applications Maybe... but if the handler rethrows the exception, what catches it in the SpringMVC environment? How would my app know to force a 500 error response back to the client? I'm trying to get my brain round that. I think I need to experiment a bit. Daniel Dekany <[email protected]> wrote on 10/21/2009 02:08:39 PM: > Wednesday, October 21, 2009, 9:58:17 PM, [email protected] wrote: > > > That's great. I think I need either IGNORE_HANDLER or perhaps develop my > > own custom handler. Either way, this is the key. Thanks! > > Nah, certainly you want the "rethrow" handler... Unless you want buggy > templates to return a some half-done response without showing any > error message to the user. > > > "Newman, John W" <[email protected]> wrote on 10/21/2009 01:13:57 > > PM: > > > >> Hi - > >> > >> Take a look at > >> > >> configuration. > >> setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); > >> > >> RETHROW_HANDLER may not be what you want ... I forget what each > >> does, there are a few different options. But that's the setting you're > > after > >> > >> -----Original Message----- > > [snip] > > > > > > > ------------------------------------------------------------------------------ > > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > > is the only developer event you need to attend this year. Jumpstart your > > developing skills, take BlackBerry mobile applications to market and stay > > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > > http://p.sf.net/sfu/devconference > > _______________________________________________ > > FreeMarker-user mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/freemarker-user > > > > -- > Best regards, > Daniel Dekany > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > FreeMarker-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/freemarker-user ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ FreeMarker-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freemarker-user ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference