Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.6
-
None
Description
currently there is no proper handling of exceptions in @PreRenderView callbacks
with that it's e.g. possible to use:
@ExceptionHandler public class ErrorViewAwareExceptionHandler { @Inject private ViewConfigResolver viewConfigResolver; public void onIllegalStateException(@Handles ExceptionEvent<IllegalStateException> e) { FacesContext facesContext = FacesContext.getCurrentInstance(); String viewId = viewConfigResolver.getDefaultErrorViewConfigDescriptor().getViewId(); UIViewRoot viewRoot = facesContext.getApplication().getViewHandler().createView(facesContext, viewId); facesContext.setViewRoot(viewRoot); //... - e.g.: store the exception in a page-bean for the default-error-view } }
later on we could support it out-of-the-box - e.g. via something like:
@ErrorView(forException = {IllegalStateException.class}) class Error extends DefaultErrorView {}