Skip to content
Snippets Groups Projects
Commit ad855527 authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

adds a proper exception for "transformation chain not found"

refs 2352
parent 66412ffa
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ import org.fortiss.tooling.kernel.service.ITransformationService;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 8B88DE0F53EE7561C069D2660CF31843
* @ConQAT.Rating YELLOW Hash: 17FC59906F6D71B73FF93580315EC8FD
*/
public final class TransformationUtils {
......@@ -80,14 +80,42 @@ public final class TransformationUtils {
if(e != null) {
throw new ChainTransformationFailedException(null, null, null, e);
}
throw new ChainTransformationFailedException(null, null, null, null) {
/** {@inheritDoc} */
@Override
public String getMessage() {
return "No transformation chain found from " + sourceElement + " to " +
targetClass.getName();
}
};
throw new NoTransformationChainFound(sourceElement, targetClass);
}
/** Exception thrown when no transformation chain was found. */
public static class NoTransformationChainFound extends ChainTransformationFailedException {
/** Element which we were trying to transform last. */
private EObject sourceElement;
/** Class which was targeted for that element. */
private Class<?> targetClass;
/** Constructor. */
public NoTransformationChainFound(EObject sourceElement, Class<?> targetClass) {
super(null, null, null, null);
this.sourceElement = sourceElement;
this.targetClass = targetClass;
}
/** {@inheritDoc} */
@Override
public String getMessage() {
return "No transformation chain found from " + sourceElement + " to " +
targetClass.getName();
}
/** Returns sourceElement. */
public EObject getSourceElement() {
return sourceElement;
}
/** Returns targetClass. */
public Class<?> getTargetClass() {
return targetClass;
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment