Added more description exception messages.

This commit is contained in:
Winston Li 2014-11-17 10:59:47 +00:00
parent bdb34f89e7
commit 3dea6036f8
5 changed files with 22 additions and 6 deletions

View file

@ -26,7 +26,6 @@ public class WLDirectoryNodeSnapshot implements CandidateSnapshot {
projectURL = "http://" + hostname + "/" + projectName;
this.directoryNode = directoryNode;
this.callback = callback;
System.out.println(getJsonRepresentation());
}
@Override
@ -67,7 +66,6 @@ public class WLDirectoryNodeSnapshot implements CandidateSnapshot {
@Override
public void approveWithVersionID(int versionID) {
System.out.println("approve with version " + versionID);
callback.approveSnapshot(versionID, this);
}

View file

@ -45,12 +45,15 @@ public class WriteLatexAPI implements WriteLatexDataSource {
@Override
public List<WritableRepositoryContents> getWritableRepositories(String projectName) throws FailedConnectionException, InvalidProjectException {
System.out.println("Fetching project: " + projectName);
return dataModel.updateProjectWithName(projectName);
}
@Override
public void putDirectoryContentsToProjectWithName(String projectName, RawDirectoryContents directoryContents, String hostname) throws SnapshotPostException, IOException, FailedConnectionException {
System.out.println("Pushing project: " + projectName);
CandidateSnapshot candidate = dataModel.createCandidateSnapshotFromProjectWithContents(projectName, directoryContents, hostname);
System.out.println(candidate.getJsonRepresentation());
SnapshotPushRequest snapshotPushRequest = new SnapshotPushRequest(candidate);
snapshotPushRequest.request();
SnapshotPushRequestResult result = snapshotPushRequest.getResult();

View file

@ -11,6 +11,11 @@ import java.util.List;
*/
public class InvalidFilesException extends SnapshotPostException {
private static final String[] DESCRIPTION_LINES = {
"You have invalid files in your WriteLatex project.",
"Check your extensions."
};
public InvalidFilesException(JsonObject json) {
super(json);
}
@ -22,7 +27,7 @@ public class InvalidFilesException extends SnapshotPostException {
@Override
public List<String> getDescriptionLines() {
return Arrays.asList("invalid files, change ext or something");
return Arrays.asList(DESCRIPTION_LINES);
}
@Override

View file

@ -10,6 +10,11 @@ import java.util.List;
*/
public class InvalidProjectException extends SnapshotPostException {
private static final String[] DESCRIPTION_LINES = {
"Your WriteLatex project is too big.",
"Delete some files and try again.."
};
public InvalidProjectException(JsonElement jsonElement) {
super(jsonElement);
}
@ -21,7 +26,7 @@ public class InvalidProjectException extends SnapshotPostException {
@Override
public List<String> getDescriptionLines() {
return Arrays.asList("your project is too big");
return Arrays.asList(DESCRIPTION_LINES);
}
@Override

View file

@ -11,18 +11,23 @@ import java.util.List;
*/
public class UnexpectedErrorException extends SnapshotPostException {
private static final String[] DESCRIPTION_LINES = {
"There was an internal error with the WriteLatex server.",
"Please contact WriteLatex."
};
public UnexpectedErrorException(JsonObject json) {
super(json);
}
@Override
public String getMessage() {
return "unexpected error";
return "writelatex error";
}
@Override
public List<String> getDescriptionLines() {
return Arrays.asList("writelatex error");
return Arrays.asList(DESCRIPTION_LINES);
}
@Override