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


Reply via email to