Kaynağa Gözat

Handle when v1 is deprecated, print a message instead of an error

Shane Kilkelly 7 yıl önce
ebeveyn
işleme
0d0c5458dd

+ 7 - 0
services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/snapshot/base/MissingRepositoryException.java

@@ -18,6 +18,13 @@ public class MissingRepositoryException extends SnapshotAPIException {
         "see https://www.overleaf.com/help/342 for more information."
     );
 
+    public static final List<String> OVERLEAF_V1_DEPRECATED_REASON = Arrays.asList(
+            "Overleaf v1 is deprecated, and you need to migrate this project to v2.",
+            "",
+            "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) {
         if (remoteUrl == null) {
             return Arrays.asList(

+ 4 - 0
services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/snapshot/base/Request.java

@@ -90,6 +90,10 @@ public abstract class Request<T extends Result> {
                             throw new MissingRepositoryException(
                                 MissingRepositoryException.buildExportedToV2Message(newRemote)
                             );
+                        } else if ("Overleaf v1 is Deprecated".equals(message)) {
+                            throw new MissingRepositoryException(
+                                    MissingRepositoryException.OVERLEAF_V1_DEPRECATED_REASON
+                            );
                         }
                     } catch (IllegalStateException
                             | ClassCastException