com.github.markusbernhardt.seleniumlibrary.aspects.RunOnFailureAspect.aj Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of robotframework-seleniumlibrary Show documentation
Show all versions of robotframework-seleniumlibrary Show documentation
Java port of the Python based SeleniumLibrary for Robot Framework
package com.github.markusbernhardt.seleniumlibrary.aspects;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import com.github.markusbernhardt.seleniumlibrary.RunOnFailureKeywords;
public aspect RunOnFailureAspect {
private static ThreadLocal lastThrowable = new ThreadLocal();
pointcut handleThrowable() :
execution(public * com.github.markusbernhardt.seleniumlibrary.keywords.*.*(..));
after() throwing(Throwable t) : handleThrowable() {
if (lastThrowable.get() == t) {
// Already handled this Throwable
return;
}
((RunOnFailureKeywords) thisJoinPoint.getTarget()).runOnFailureByAspectJ();
lastThrowable.set(t);
}
}