use of net.sf.sahi.report.ResultType in project sakuli by ConSol.
the class RhinoAspect method doHandleRhinoException.
/**
* Aspect to fetch all Logs from the Sahi-Proxy by the method {@link net.sf.sahi.ant.Report} and do an trusty
* exception handling on top of that.
*
* @param joinPoint injected joinPoint of the execution
*/
@Before("execution(* net.sf.sahi.report.Report.addResult(..))")
public void doHandleRhinoException(JoinPoint joinPoint) {
// Read out all args
Object[] args = joinPoint.getArgs();
ResultType resultType;
if (args[1] instanceof ResultType) {
resultType = (ResultType) args[1];
} else {
resultType = ResultType.getType((String) args[1]);
}
LogResult logResult = new LogResult((String) args[0], resultType, (String) args[2], (String) args[3]);
if (logResult.getFailureMsg() == null || !logResult.getFailureMsg().contains(ALREADY_PROCESSED)) {
//log and handle exception from sahi actions
if (ResultType.ERROR.equals(resultType) || ResultType.FAILURE.equals(resultType)) {
BaseActionLoader environmentLoader = BeanLoader.loadBaseActionLoader();
environmentLoader.getExceptionHandler().handleException(logResult);
} else /**
* all Actions in Package {@link org.sakuli.actions} should be already logged by
* {@link #doAddActionLog(org.aspectj.lang.JoinPoint, org.sakuli.actions.logging.LogToResult)}.
*/
if (logResult.getDebugInfo() == null || !logResult.getDebugInfo().startsWith("org.sakuli.actions.")) {
logger.info(logResult.getMessage());
}
}
}
Aggregations