com.github.markusbernhardt.selenium2library.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-selenium2library-java Show documentation
Show all versions of robotframework-selenium2library-java Show documentation
Java port of the Selenium 2 (WebDriver) Python library for Robot Framework
The newest version!
package com.github.markusbernhardt.selenium2library.aspects;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import com.github.markusbernhardt.selenium2library.RunOnFailureKeywords;
public aspect RunOnFailureAspect {
private static ThreadLocal lastThrowable = new ThreadLocal();
pointcut handleThrowable() :
execution(public * com.github.markusbernhardt.selenium2library.keywords.*.*(..));
after() throwing(Throwable t) : handleThrowable() {
if (lastThrowable.get() == t) {
// Already handled this Throwable
return;
}
((RunOnFailureKeywords) thisJoinPoint.getTarget()).runOnFailureByAspectJ();
lastThrowable.set(t);
}
}