Re: Over-riding handleException?
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.