Merge pull request #47 from overleaf/sk-print-good-error-when-404

When user clone/pull/etc a project which doesn't exist, print a nice message
This commit is contained in:
Shane Kilkelly 2018-12-14 09:46:26 +00:00 committed by GitHub
commit 26ff545415
2 changed files with 26 additions and 22 deletions

View file

@ -109,7 +109,10 @@ public class WLRepositoryResolver
} catch (ForbiddenException e) {
throw new ServiceNotAuthorizedException();
} catch (GitUserException e) {
throw new ServiceMayNotContinueException(e.getMessage(), e);
throw new ServiceMayNotContinueException(
e.getMessage() + "\n" +
String.join("\n", e.getDescriptionLines()),
e);
} catch (IOException e) {
Log.warn(
"IOException when trying to open repo: " + projName,

View file

@ -10,9 +10,12 @@ import java.util.List;
public class MissingRepositoryException extends SnapshotAPIException {
public static final List<String> GENERIC_REASON = Arrays.asList(
"This Overleaf project currently has no git access.",
"This Overleaf project currently has no git access, either because",
"the project does not exist, or because git access is not enabled",
"for the project.",
"",
"If this problem persists, please contact us."
"If this is unexpected, please contact us at support@overleaf.com, or",
"see https://www.overleaf.com/help/342 for more information."
);
static List<String> buildExportedToV2Message(String remoteUrl) {
@ -43,9 +46,7 @@ public class MissingRepositoryException extends SnapshotAPIException {
private List<String> descriptionLines;
public MissingRepositoryException() {
descriptionLines = new ArrayList<String>();
}
public MissingRepositoryException() { this.descriptionLines = GENERIC_REASON; }
public MissingRepositoryException(List<String> descriptionLines) {
this.descriptionLines = descriptionLines;