mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
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:
commit
26ff545415
2 changed files with 26 additions and 22 deletions
|
@ -109,7 +109,10 @@ public class WLRepositoryResolver
|
||||||
} catch (ForbiddenException e) {
|
} catch (ForbiddenException e) {
|
||||||
throw new ServiceNotAuthorizedException();
|
throw new ServiceNotAuthorizedException();
|
||||||
} catch (GitUserException e) {
|
} catch (GitUserException e) {
|
||||||
throw new ServiceMayNotContinueException(e.getMessage(), e);
|
throw new ServiceMayNotContinueException(
|
||||||
|
e.getMessage() + "\n" +
|
||||||
|
String.join("\n", e.getDescriptionLines()),
|
||||||
|
e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.warn(
|
Log.warn(
|
||||||
"IOException when trying to open repo: " + projName,
|
"IOException when trying to open repo: " + projName,
|
||||||
|
|
|
@ -10,42 +10,43 @@ import java.util.List;
|
||||||
public class MissingRepositoryException extends SnapshotAPIException {
|
public class MissingRepositoryException extends SnapshotAPIException {
|
||||||
|
|
||||||
public static final List<String> GENERIC_REASON = Arrays.asList(
|
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) {
|
static List<String> buildExportedToV2Message(String remoteUrl) {
|
||||||
if (remoteUrl == null) {
|
if (remoteUrl == null) {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
"This Overleaf project has been moved to Overleaf v2 and cannot be used with git at this time.",
|
"This Overleaf project has been moved to Overleaf v2 and cannot be used with git at this time.",
|
||||||
"",
|
"",
|
||||||
"If this error persists, please contact us at support@overleaf.com, or",
|
"If this error persists, please contact us at support@overleaf.com, or",
|
||||||
"see https://www.overleaf.com/help/342 for more information."
|
"see https://www.overleaf.com/help/342 for more information."
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
"This Overleaf project has been moved to Overleaf v2 and has a new identifier.",
|
"This Overleaf project has been moved to Overleaf v2 and has a new identifier.",
|
||||||
"Please update your remote to:",
|
"Please update your remote to:",
|
||||||
"",
|
"",
|
||||||
" " + remoteUrl,
|
" " + remoteUrl,
|
||||||
"",
|
"",
|
||||||
"Assuming you are using the default \"origin\" remote, the following commands",
|
"Assuming you are using the default \"origin\" remote, the following commands",
|
||||||
"will change the remote for you:",
|
"will change the remote for you:",
|
||||||
"",
|
"",
|
||||||
" git remote set-url origin " + remoteUrl,
|
" git remote set-url origin " + remoteUrl,
|
||||||
"",
|
"",
|
||||||
"If this does not work, please contact us at support@overleaf.com, or",
|
"If this does not work, please contact us at support@overleaf.com, or",
|
||||||
"see https://www.overleaf.com/help/342 for more information."
|
"see https://www.overleaf.com/help/342 for more information."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> descriptionLines;
|
private List<String> descriptionLines;
|
||||||
|
|
||||||
public MissingRepositoryException() {
|
public MissingRepositoryException() { this.descriptionLines = GENERIC_REASON; }
|
||||||
descriptionLines = new ArrayList<String>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public MissingRepositoryException(List<String> descriptionLines) {
|
public MissingRepositoryException(List<String> descriptionLines) {
|
||||||
this.descriptionLines = descriptionLines;
|
this.descriptionLines = descriptionLines;
|
||||||
|
|
Loading…
Reference in a new issue