All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.markusbernhardt.seleniumlibrary.aspects.RunOnFailureAspect.aj Maven / Gradle / Ivy

There is a newer version: 4.0.0-alpha-2.0
Show newest version
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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy