mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
fix minor version issues
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
package com.dfsek.terra.api.transform;
|
||||
|
||||
import com.dfsek.terra.api.util.GlueList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AttemptsFailedException extends RuntimeException {
|
||||
public AttemptsFailedException() {
|
||||
super();
|
||||
}
|
||||
private final List<Throwable> causes;
|
||||
|
||||
public AttemptsFailedException(String message) {
|
||||
public AttemptsFailedException(String message, List<Throwable> causes) {
|
||||
super(message);
|
||||
this.causes = causes;
|
||||
}
|
||||
|
||||
public AttemptsFailedException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public AttemptsFailedException(Throwable cause) {
|
||||
super(cause);
|
||||
public List<Throwable> getCauses() {
|
||||
return new GlueList<>(causes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.dfsek.terra.api.transform;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -28,7 +26,7 @@ public class Transformer<F, T> {
|
||||
* @return Result
|
||||
*/
|
||||
public T translate(F from) {
|
||||
List<Exception> exceptions = new ArrayList<>();
|
||||
List<Throwable> exceptions = new ArrayList<>();
|
||||
for(Map.Entry<Transform<F, T>, List<Validator<T>>> transform : transformers.entrySet()) {
|
||||
try {
|
||||
T result = transform.getKey().transform(from);
|
||||
@@ -42,13 +40,7 @@ public class Transformer<F, T> {
|
||||
exceptions.add(exception);
|
||||
}
|
||||
}
|
||||
StringBuilder exBuilder = new StringBuilder("Could not transform input; all attempts failed: ").append(from.toString()).append("\n");
|
||||
for(Exception exception : exceptions) {
|
||||
StringWriter writer = new StringWriter();
|
||||
exception.printStackTrace(new PrintWriter(writer));
|
||||
exBuilder.append("\n").append(writer.toString());
|
||||
}
|
||||
throw new AttemptsFailedException(exBuilder.toString());
|
||||
throw new AttemptsFailedException("Could not transform input; all attempts failed: " + from.toString() + "\n", exceptions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,7 +57,7 @@ public class TreeRegistry extends TerraRegistry<Tree> {
|
||||
private void addTree(String id) {
|
||||
try {
|
||||
add(id, main.getWorldHandle().getTree(id));
|
||||
} catch(IllegalArgumentException e) {
|
||||
} catch(Exception e) {
|
||||
main.getLogger().warning("Unable to load tree " + id + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user