• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF 2.0 exception handling

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I want to throw a custom exception "AppException" in my controller, where this AppException extends Exception. And to catch it in my CustomExceptionHandler.
The problem is that when I go to the CustomExceptionHandler, I get the exception as "FacesException" not "AppException "

<factory>
<exception-handler-factory>com.web.common.exceptions.DefaultExceptionHandlerFactory</exception-handler-factory>
</factory>

public class DefaultExceptionHandlerFactory extends ExceptionHandlerFactory {
public ExceptionHandler getExceptionHandler() {
ExceptionHandler eh = new DefaultExceptionHandler(parent.getExceptionHandler());
return eh;
}
}

public class DefaultExceptionHandler extends ExceptionHandlerWrapper {
public void handle() throws FacesException {
Iterator i = getUnhandledExceptionQueuedEvents().iterator();
while (i.hasNext()) {
ExceptionQueuedEvent event = (ExceptionQueuedEvent) i.next();
ExceptionQueuedEventContext context =
(ExceptionQueuedEventContext)event.getSource();

//obtain throwable object
Throwable t = context.getException();
............
}
}
}

Any help?
reply
    Bookmark Topic Watch Topic
  • New Topic