• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Over-riding handleException?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Over-riding handleException?


  • Subject: Re: Over-riding handleException?
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 13 Mar 2003 17:39:15 -0800
  • Organization: Global Village Consulting, Inc.

Hi Jonathan,

Jonathan Rochkind wrote:

When over-riding handleException on WOApplication, to provide a custom exception page, and I want to return a component response... what's the proper way to instantiate the component? WOApplication.pageWithName?

Yes.


Should I pass in the context as argument to pageWithName that was the argumetn to handleException?


That is working for me.


handleException requires a WOResponse return value. Should I simply call generateResponse on my component instance and return that?

Yep, return errorPage.generateResponse();


The very most important thing to remember is to wrap it in a try...catch block. If any uncaught exception is raised in your error handler it causes havoc in the framework. It escapes me what it was that happened, but I felt it was bad. Perhaps that session become immortal and recycling does not work for that instance. Something like that.



public WOResponse handleException( java.lang.Exception anException, WOContext aContext ) { WOResponse exceptionPage = null;

    try
    {
        exceptionPage = pageWithName("ErrorPage", aContext).generateResponse();
    catch (Throwable t)
    {
            // Our exception handler raised an exception!
    }

    // Handle exceptions raised by our custom error handler.
    if (exceptionPage == null)
    {
        exceptionPage = super.handleException(anException, aContext);
    }

    return exceptionPage;
}


Chuck



--

Chuck Hill                                 email@hidden
Global Village Consulting Inc.             http://www.global-village.net
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Over-riding handleException?
  • Next by Date: Re: SOLVED: Multi-threading 5.2 WO app as servlet or woapp doesn't work
  • Previous by thread: Over-riding handleException?
  • Next by thread: Re: SOLVED: Multi-threading 5.2 WO app as servlet or woapp doesn't work
  • Index(es):
    • Date
    • Thread