Yea, I agree. On 8/11/05, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > That seems to be the most elegant solution. > -Igor > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf > > Of Jonathan Locke > > Sent: Thursday, August 11, 2005 4:54 PM > > To: [email protected] > > Subject: Re: [Wicket-develop] Let's talk about exceptions. > > > > > > the thing that's missing from it is that you can't stop the > > default handling from happening. > > > > maybe it should return a Page to redirect to. if you return > > null, then wicket redirects to its own Page... > > > > Igor Vaynberg wrote: > > > > >There is already a RequestCycle.onRuntimeException(final Page page, > > >final RuntimeException e) where you can handle exceptions > > globally. Why > > >introduce extra complexity? > > > > > >-Igor > > > > > > > > > > > > > > >>-----Original Message----- > > >>From: [EMAIL PROTECTED] > > >>[mailto:[EMAIL PROTECTED] On Behalf Of > > >>Jonathan Locke > > >>Sent: Thursday, August 11, 2005 4:45 PM > > >>To: [email protected] > > >>Subject: Re: [Wicket-develop] Let's talk about exceptions. > > >> > > >> > > >>all we'd have to do to allow you to handle exceptions > > globally is make > > >>this method protected and non-final: > > >> > > >> private final void redirectToExceptionErrorPage(final > > >>Page page, final RuntimeException e) throws ServletException > > >> > > >>that's the location that all exceptions are funneled through. > > >> it has the page and the exception. > > >>you'd just subclass requestcycle as you probably are already doing. > > >> > > >>we could easily add an Application method to make this > > easier to hook > > >>this /if it's really a common thing people want to do for their > > >>application/. we'd add > > >> > > >>Application.onRuntimeException(Page page, RuntimeException e) > > >> > > >>and call that from redirectToExceptionErrorPage(). right? > > >> > > >>Michael Jouravlev wrote: > > >> > > >> > > >> > > >>>On 8/11/05, Phil Kulak <[EMAIL PROTECTED]> wrote: > > >>> > > >>> > > >>> > > >>> > > >>>>I didn't get much input on this when I was commenting in > > another's > > >>>>thread, so I thought I'd start a whole topic on it. Anyway, is it > > >>>>planned to give the developer some way to get at thrown > > >>>> > > >>>> > > >>exceptions in > > >> > > >> > > >>>>a central place and handle them? I keep coming on > > situations when I > > >>>>need to do this, and I have no idea how to go about it. > > >>>> > > >>>>Some examples. You've got a shopping cart and a checkout > > >>>> > > >>>> > > >>process. You > > >> > > >> > > >>>>don't want the user to be able to start the checkout > > >>>> > > >>>> > > >>process with an > > >> > > >> > > >>>>empty cart. My first instinct is to check for an empty cart on > > >>>>construction and throw a custom exception if the cart's > > empty, but > > >>>>since I can't get to it further up the stack, that doesn't get me > > >>>>anywhere. > > >>>> > > >>>> > > >>>> > > >>>> > > >>>I don't see how this is different from validating a form. > > >>> > > >>> > > >>How exactly a > > >> > > >> > > >>>user would get to checkout? Either with button or link. Link > > >>> > > >>> > > >>should not > > >> > > >> > > >>>be a page link, it should be what JSF calls "command link". > > >>>Basically, it is the same submit action on a page, but via > > >>> > > >>> > > >>link. Ok, it > > >> > > >> > > >>>is not a submit, but it still should call event handler on > > a current > > >>>page. So, you can check for empty cart, generate error message and > > >>>redirect to same page. > > >>> > > >>> > > >>> > > >>> > > >>> > > >>>>Or how about if I user tries to view a bookmarked page for > > >>>> > > >>>> > > >>an object > > >> > > >> > > >>>>that doesn't exist anymore? You can't draw the page without > > >>>> > > >>>> > > >>an object > > >> > > >> > > >>>>to draw from, so you throw an exception. It would be nice > > >>>> > > >>>> > > >>to then show > > >> > > >> > > >>>>the user some friendly message ("the object doesn't exist > > >>>>anymore..."), but currently your only options are a stack > > >>>> > > >>>> > > >>trace or a > > >> > > >> > > >>>>general exception message. > > >>>> > > >>>> > > >>>> > > >>>> > > >>>"Object not found" is a pretty specific exception. There > > should be a > > >>>app-scoped page for this. Also, each Page can define "not found" > > >>>location for itself. > > >>> > > >>>Why you cannot get exception further up the stack? How > > about global > > >>>error handler for a start, like Struts has? Where you can > > define all > > >>>exceptions you want to catch globally. > > >>> > > >>>Michael. > > >>> > > >>> > > >>>------------------------------------------------------- > > >>>SF.Net email is Sponsored by the Better Software Conference & EXPO > > >>>September 19-22, 2005 * San Francisco, CA * Development Lifecycle > > >>>Practices Agile & Plan-Driven Development * Managing > > >>> > > >>> > > >>Projects & Teams * > > >> > > >> > > >>>Testing & QA Security * Process Improvement & Measurement * > > >>>http://www.sqe.com/bsce5sf > > >>>_______________________________________________ > > >>>Wicket-develop mailing list > > >>>[email protected] > > >>>https://lists.sourceforge.net/lists/listinfo/wicket-develop > > >>> > > >>> > > >>> > > >>> > > >>> > > >>------------------------------------------------------- > > >>SF.Net email is Sponsored by the Better Software Conference & EXPO > > >>September 19-22, 2005 * San Francisco, CA * Development Lifecycle > > >>Practices Agile & Plan-Driven Development * Managing > > Projects & Teams > > >>* Testing & QA Security * Process Improvement & Measurement * > > >>http://www.sqe.com/bsce5sf > > >>_______________________________________________ > > >>Wicket-develop mailing list > > >>[email protected] > > >>https://lists.sourceforge.net/lists/listinfo/wicket-develop > > >> > > >> > > >> > > >> > > >> > > > > > > > > > > > > > > >------------------------------------------------------- > > >SF.Net email is Sponsored by the Better Software Conference & EXPO > > >September 19-22, 2005 * San Francisco, CA * Development Lifecycle > > >Practices Agile & Plan-Driven Development * Managing > > Projects & Teams * > > >Testing & QA Security * Process Improvement & Measurement * > > >http://www.sqe.com/bsce5sf > > >_______________________________________________ > > >Wicket-develop mailing list > > >[email protected] > > >https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > > > > > > > > > > > > > ------------------------------------------------------- > > SF.Net email is Sponsored by the Better Software Conference & > > EXPO September 19-22, 2005 * San Francisco, CA * Development > > Lifecycle Practices Agile & Plan-Driven Development * > > Managing Projects & Teams * Testing & QA Security * Process > > Improvement & Measurement * http://www.sqe.com/bsce5sf > > _______________________________________________ > > Wicket-develop mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > > > > > > > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Wicket-develop mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wicket-develop >
------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
