return cb.getPageException();
}
if(object instanceof PageException) return (PageException)object;
if(object instanceof Throwable) {
Throwable t=(Throwable)object;
return new CustomTypeException(t.getMessage(),"","",t.getClass().getName(),"");
}
if(object instanceof Struct){
Struct sct=(Struct) object;
String type=Caster.toString(sct.get(KeyConstants._type,""),"").trim();
String msg=Caster.toString(sct.get(KeyConstants._message,null),null);
if(!StringUtil.isEmpty(msg, true)) {
String detail=Caster.toString(sct.get(KeyConstants._detail,null),null);
String errCode=Caster.toString(sct.get("ErrorCode",null),null);
String extInfo=Caster.toString(sct.get("ExtendedInfo",null),null);
PageException pe=null;
if("application".equalsIgnoreCase(type))
pe = new ApplicationException(msg, detail);
else if("expression".equalsIgnoreCase(type))
pe = new ExpressionException(msg, detail);
else
pe=new CustomTypeException(msg, detail, errCode, type, extInfo);
// Extended Info
if(!StringUtil.isEmpty(extInfo,true))pe.setExtendedInfo(extInfo);
// Error Code