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

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

There is a newer version: 1.4.0.8
Show 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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy