Hi Warner, Yes that what I would do. regards Malcolm Edgar
On Fri, Oct 2, 2009 at 6:37 PM, WarnerJan Veldhuis < [email protected]> wrote: > Right, I think I found a way to do this. Probably the only right way ;) > > I have subclassed ErrorPage, overridden getTemplate() to return the base > template, and created a custom click/error.htm. Is this the way to go? > > Cheers, > WarnerJan > > > > On 10/02/2009 10:21 AM, WarnerJan Veldhuis wrote: > > Hey Bob, > > Thanks for th response. I have been playing around with a custom errorpage, > but apparently you *have* to subclass Click's ErrorPage in order to make it > work. How do I integrate this page with my current template? > > I have a TemplatePage class that will take care of layout and stuff, and I > want my error page to fit right in the existing layout. But I cannot let my > errorpage extends TemplatePage because of the before mentioned restriction. > > Is it an idea to make ErrorPage an interface instead of a class with, let's > say *void setError( Throwable t)* so any page can function as an > ErrorPage? > > Cheers > > WarnerJan > > > On 10/02/2009 12:44 AM, Bob Schellink wrote: > > Hi WarnerJan, > > All RuntimeExceptions thrown by the application will be handled by Click's > ErrorPage. So how about wrapping the parse code in a try/catch block and > rethrow a RuntimeException or custom exception e.g: > SecurityException/TamperException and let Click ErrorPage display the > message? You can also create your own ErrorPage subclass to customize error > handling if you're not happy with the default behavior. > > If you're application is i18n aware you can lookup the error messages from > the ErrorPage's property file. > > kind regards > > bob > > WarnerJan Veldhuis wrote: > > Hello list, > > I have a class that extends RequestTypeConverter. The issue that rises, is > that I cannot handle errors very well. For example, I have this URL: > /Portal/publish.htm?configuration=1. In order to get the VO, I need to parse > the value. This would be a String containing "1". Integer.parseInt( (String) > value) will get me an int containing 1. > > But if people start messing with the URL, and for example enter > configuration=blah, parseInt will throw a ParseException. What do I do with > that Exception? Rethrow? Catch, and then what? It's not clear how to handle > errors here. > > Same goes for semantic errors. If they change the number from 1 to 42, they > might not have access to that particular VO. The backend will throw an > InsufficientRightsException, and what do I do with that? > > Thanks for thinking along :) > > Cheers, > > WarnerJan Veldhuis > >
