because it doesnt always do this. depends on where it is thrown from and by whom. we cannot guarantee anything so you need to do the searching for the root cause yourself.

-Igor


On 3/27/06, Ingram Chen <[EMAIL PROTECTED]> wrote:
If it always wrap runtime exception, why not change the method signature to:

 public Page onRuntimeException(Page page, WicketRuntimeException we) {

and WicketRuntimeException provide an additional method to obtain root cause ?

API user should not care about what Wicket does internally.



On 3/28/06, SourceForge.net <[EMAIL PROTECTED] > wrote:
Bugs item #1458087, was opened at 2006-03-25 00:45
Message generated for change (Comment added) made by ivaynberg
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=684975&aid=1458087&group_id=119783

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: 1.2
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Ingram Chen (ingramchen)
>Assigned to: Igor Vaynberg (ivaynberg)
Summary: Unable deal with specific runtime exception

Initial Comment:
  I want to catch a specific RuntimeException and then
redirect to a special
error page (not global one), I try to do this:


    @Override
    protected IRequestCycleFactory
getDefaultRequestCycleFactory() {
        return new IRequestCycleFactory() {
            private static final long serialVersionUID
= 1L;

            public RequestCycle newRequestCycle(Session
session,
                    Request request, Response response) {
                // Respond to request
                return new WebRequestCycle((WebSession)
session,
                        (WebRequest) request,
(WebResponse) response) {

                    @Override
                    public Page onRuntimeException(Page
page, RuntimeException e) {
                        if (e instanceof
MyRuntimeException) {
                            return new
MySpecificErrorPage();
                        } else {
                            return
super.onRuntimeException(page, e);
                        }
                    }
                };
            }
        };
    }

But I got internal error page.

Attachement is a small test that modified from
wicket-examples/Echo

----------------------------------------------------------------------

>Comment By: Igor Vaynberg (ivaynberg)
Date: 2006-03-28 06:14

Message:
Logged In: YES
user_id=1293035

this is not a bug. you cannot do an instanceof check because
the exception might be wrapped by other exceptions, in this
case a WicketRuntimeException.

what you need to do is search up the cause stack until you
get the root cause, and then do an instanceof check on that.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=684975&aid=1458087&group_id=119783



--
Ingram Chen
Java [EMAIL PROTECTED]
Institue of BioMedical Sciences Academia Sinica Taiwan
blog: http://www.javaworld.com.tw/roller/page/ingramchen

Reply via email to