If a partial AJAX request returned some error, PrimeFaces based web application did not respond to this error and user didn't know,
where is the problem and how he/she can continue to work. The most often problem with AJAX errors is, when some action / actionListener
throws an unexpected exception and developer don't catch all exceptions (e.g. falied DB save operation or expired Session-, ViewScope).
Maybe you have also experienced that during development - user's actions has no affect after session expiration
(no response from server). Because PrimeFaces ignores a lot of errors, finding out the real reason of problem takes a long time without any error information.
Component pe:ajaxErrorHandler is created to overcome these cases and provide a better AJAX error handling.
The component enables message displaying in case of detection of an AJAX error. In case of need, you can define different behaviours for various types of errors.
The best way to understand the behaviour is through examples.
Simple and Extended mode
Component ajaxErrorHandler can be used in simple and extended mode. Extended mode is activated when our exception-handler-factory is used in faces-config.xml
Extended mode – handler solves problem, when javax.faces.PARTIAL_STATE_SAVING=false and javax.faces.STATE_SAVING_METHOD=server are set in web.xml and session is lost (cannot be restored after ViewExpiredException)