Re: Handling exceptions during render

2008-11-04 Thread aditsu
Alex Objelean wrote: Can you be more specific? What kind of unexpected runtime exceptions are you talking about? I don't think I understood you correctly. It could be anything.. NPE (probably the most popular), IllegalArgumentException and its descendants, ArithmeticException,

Re: Handling exceptions during render

2008-11-04 Thread aditsu
igor.vaynberg wrote: i would hate a user to look at a signup form without a signup button because something inside it caused an error. i would also hate to see a user at a checkout page with a missing $500.00 discount amount shown because there was an error in the discount label.

Re: Handling exceptions during render

2008-11-04 Thread aditsu
aditsu wrote: Anyway, I want to have the option to catch exceptions from child components at certain points that I can define. And I think I got a new idea.. involving replace and RestartResponseException Well, it seems to work, except I had to call setAuto(true) on the replacement

Re: Handling exceptions during render

2008-11-03 Thread Alex Objelean
There are more threads about this issue... In order to catch all runtime exception, you have to override default RequestCycle (newRequestCycle method) in your application class and override private Page handleRuntimeException(final Page page, final RuntimeException e) method. Alex Objelean

Re: Handling exceptions during render

2008-11-03 Thread aditsu
Ok, but how would that let me render the rest of the page? Alex Objelean wrote: There are more threads about this issue... In order to catch all runtime exception, you have to override default RequestCycle (newRequestCycle method) in your application class and override

Re: Handling exceptions during render

2008-11-03 Thread aditsu
Thanks, but I can't find any handleRuntimeException method in any class. I'm using wicket 1.4-m3. Also, if the method is private, then how can I possibly override it? Alex Objelean wrote: There are more threads about this issue... In order to catch all runtime exception, you have to

Re: Handling exceptions during render

2008-11-03 Thread Alex Objelean
Sorry for mistake... I've updated the comment aditsu wrote: Thanks, but I can't find any handleRuntimeException method in any class. I'm using wicket 1.4-m3. Also, if the method is private, then how can I possibly override it? Alex Objelean wrote: There are more threads about this

Re: Handling exceptions during render

2008-11-03 Thread Erik van Oosten
It won't. I think you have to dig deeper into the request rendering. Perhaps that overriding MarkupContainer#renderAll on all your Panels that have expected exceptions will help. But then again, exceptions are intended for controlling the non-expected. You should not use exceptions for

Re: Handling exceptions during render

2008-11-03 Thread Alex Objelean
If you return null in onRuntimeException - the stack trace will be shown. But if you will return a page instance, the application will redirect you to this page. For instance: [CODE] @Override public Page onRuntimeException(final Page page, final RuntimeException e) { //do

Re: Handling exceptions during render

2008-11-03 Thread aditsu
Well, I'm specifically talking about unexpected runtime exceptions. I don't want those to destroy the whole page. They can kill a component, that's ok, but the rest of the page should work. And yes I want to make sure that no exceptions are thrown, except that's not so simple when you're dealing

Re: Handling exceptions during render

2008-11-03 Thread Erik van Oosten
Yeah, I was afraid it would come to that. Sorry, you've apparently done some more research already... Another thing I sometimes do is take the Wicket class and put it in the web-project's classpath but with my changes (e.g. remove a final). All servlet containers will load earlier from the

Re: Handling exceptions during render

2008-11-03 Thread Alex Objelean
Can you be more specific? What kind of unexpected runtime exceptions are you talking about? I don't think I understood you correctly. Any runtime exception thrown by the wicket is caused by a programming error... there is no sense to catch it without fixing the problem in your code. Catching