• 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: Catch "Internal Server Error"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Catch "Internal Server Error"


  • Subject: Re: Catch "Internal Server Error"
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 18 May 2006 09:55:08 -0700

Hi François,

Yes, you can handle these sorts of errors. They happen either very early or very late in the request - response loop and WebObjects is not setup to handle them properly. Unfortunately, this is left up to you. Here is how to do this:

1. Once source of this error is in the appendToResponse phase of pages/components returned from direct actions. WO is not prepared to catch that exception. To fix this, we can force the rendering to happen earlier. Add / edit this method in DirectAction:

public WOActionResults performActionNamed(String actionName)
{
WOActionResults result;
try
{
result = super.performActionNamed(actionName);
result = result.generateResponse(); // render page
}
catch(Throwable t)
{
result = WOApplication.application().handleException(new NSForwardException(t), context());
}


         return result;
      }

I am not sure if the try...catch block is needed anymore, it was once and won't hurt.


2. I am not certain that this case is a problem anymore, but it was once. Add this method to Application:


    public WOResponse dispatchRequest(WORequest request)
    {
        WOResponse response;

try
{
response = super.dispatchRequest(request);
}
catch(Throwable t)
{
response = WOApplication.application().handleException (new NSForwardException(t), createContextForRequest(request));
}


        return response;
    }


This will allow the normal exception handling that Andrew mentioned to work.




Chuck


On May 18, 2006, at 1:30 AM, François Reboursier wrote:

	Hi list,

As all developers knows, in a perfect world, an app wouldn't crash, everything would go smooth, but hey, s**t happens.
So sometimes, I get the dreaded and ugly "An Internal Server Error Has Occurred." page (most of the time I forget to update the DB to match my EOModel, easy fix)


Is there any way to catch this do display a "better" error page, or to customise this page ?

Thanks,
François


--
Coming in 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro


Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects




_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Catch "Internal Server Error"
      • From: Guido Neitzer <email@hidden>
References: 
 >Catch "Internal Server Error" (From: François Reboursier <email@hidden>)

  • Prev by Date: xml data update and its derived data synchronization problem
  • Next by Date: Re: xml data update and its derived data synchronization problem
  • Previous by thread: Catch "Internal Server Error"
  • Next by thread: Re: Catch "Internal Server Error"
  • Index(es):
    • Date
    • Thread