Use dedicated exceptions to track incompatible/missing plugin

to be used by other component to log/resolve configuration issue.
This commit is contained in:
Nicolas De Loof committed 2014-02-11 13:31:38 +01:00
1 parent 2d40b7e7e9
commit b32d0e4f74
1 file changed
+19 -2
+19 -2
View File
@@ -501,10 +501,10 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
}
if (!missingDependencies.isEmpty())
throw new IOException("Dependency "+Util.join(missingDependencies, ", ")+" doesn't exist");
throw new MissingDepencyException("Dependency "+Util.join(missingDependencies, ", ")+" doesn't exist", missingDependencies);
if (!incompatibleDependencies.isEmpty())
throw new IOException("Dependency "+Util.join(incompatibleDependencies, ", ")+" doesn't match required version");
throw new IncompatibleDependencyException("Dependency "+Util.join(incompatibleDependencies, ", ")+" doesn't match required version", incompatibleDependencies);
}
@@ -646,4 +646,21 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
private static final Logger LOGGER = Logger.getLogger(PluginWrapper.class.getName());
public class IncompatibleDependencyException extends IOException {
public final List<String> plugins;
public IncompatibleDependencyException(String message, List<String> plugins) {
super(message);
this.plugins = plugins;
}
}
public class MissingDepencyException extends IOException {
public final List<String> plugins;
public MissingDepencyException(String message, List<String> plugins) {
super(message);
this.plugins = plugins;
}
}
}