mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 23:20:47 +02:00
Removed print and gave more descriptive error.
This commit is contained in:
+5
-12
@@ -1,9 +1,9 @@
|
||||
package uk.ac.ic.wlgitbridge.writelatex.api.request.push.exception;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -12,10 +12,6 @@ import java.util.List;
|
||||
*/
|
||||
public class InvalidFilesException extends SnapshotPostException {
|
||||
|
||||
private static final String[] DESCRIPTION_LINES = {
|
||||
"You have invalid files in your WriteLatex project."
|
||||
};
|
||||
|
||||
private List<String> descriptionLines;
|
||||
|
||||
public InvalidFilesException(JsonObject json) {
|
||||
@@ -35,13 +31,10 @@ public class InvalidFilesException extends SnapshotPostException {
|
||||
@Override
|
||||
public void fromJSON(JsonElement json) {
|
||||
descriptionLines = new LinkedList<String>();
|
||||
descriptionLines.addAll(Arrays.asList(DESCRIPTION_LINES));
|
||||
try {
|
||||
for (JsonElement error : json.getAsJsonObject().get("errors").getAsJsonArray()) {
|
||||
descriptionLines.add(describeError(error.getAsJsonObject()));
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
JsonArray errors = json.getAsJsonObject().get("errors").getAsJsonArray();
|
||||
descriptionLines.add("You have " + errors.size() + " invalid files in your WriteLatex project:");
|
||||
for (JsonElement error : errors) {
|
||||
descriptionLines.add(describeError(error.getAsJsonObject()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user