mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Removed print and gave more descriptive error.
This commit is contained in:
parent
ce9351186c
commit
3d19cb95b9
1 changed files with 5 additions and 12 deletions
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue