1 5 package org.exoplatform.faces.core.event; 6 7 import java.util.List ; 8 import javax.faces.context.FacesContext ; 9 import javax.faces.component.UIViewRoot; 10 import org.exoplatform.container.SessionContainer ; 11 import org.exoplatform.faces.core.component.UIFatalError; 12 import org.exoplatform.services.log.LogUtil; 13 19 public class FatalExceptionHandler extends ExceptionHandler { 20 21 public boolean canHandleError(Throwable error) { 22 return true ; 23 } 24 25 public void handle(ExoActionEvent action, Throwable error) { 26 UIViewRoot uiroot = FacesContext.getCurrentInstance().getViewRoot() ; 27 List children = uiroot.getChildren(); 28 for(int i = 0; i < children.size(); i++) { 29 children.remove(i); 30 } 31 children.add(new UIFatalError(error)) ; 32 LogUtil.getLog(getClass()).error("Handle action " + action.getAction(), error) ; 33 } 34 } 35 | Popular Tags |