Child pages
  • Development-Custom Error Handling

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Exception Page

To provide a custom error handler when an exception is thrown, override the method:

...

Code Block
public WOResponse handleException(Exception _exception, WOContext _context) {
  Session session = (Session) _context.session();
  // do something to notify user of exception, maybe put a message in the session here ...
  WOResponse response;
  if (/* you can't handle exception*/) {
    response = super.handleException(_exception, _context);
  }
  else {
    response = pageWithName(YourExceptionPage.class.getName(), _context).generateResponse();
  }
  return response;
} 

Session Expired

To provide a custom error handler when an exception is thrown, override the method:

...

Code Block
public WOResponse handleSessionRestorationErrorInContext(WOContext _context) {
  Session session = (Session) _context.session();
  // do something to notify user of exception, maybe put a message in the session here ...
  WOResponse response = pageWithName(YourErrorPage.class.getName(), _context).generateResponse();
  return response;
}

Your Request Produced an Error

Chuck Hill

This message started to appear in WO 5.2 when an exception was raised in a DirectAction, but only in deployed applications. Here is what is happening:

...

This won't work if you put it in the constructor.Category:WebObjects