]> source.dussan.org Git - jgit.git/commitdiff
Allow setting detail message and cause when constructing most exceptions 80/49280/1
authorJonathan Nieder <jrn@google.com>
Tue, 2 Jun 2015 23:52:21 +0000 (16:52 -0700)
committerJonathan Nieder <jrn@google.com>
Tue, 2 Jun 2015 23:54:09 +0000 (16:54 -0700)
In particular, this means a RepositoryResolver, UploadPackFactory, or
ReceivePackFactory can set a detail message for
ServiceNotAuthorizedException or ServiceNotEnabledException with
information for the client about why access is not allowed.

Change-Id: I38e1798e1e9d09b5e75cefacd9d85f25729235a9
Signed-off-by: Jonathan Nieder <jrn@google.com>
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/RefNotFoundException.java
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/StashApplyFailureException.java
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/UnmergedPathsException.java
org.eclipse.jgit/src/org/eclipse/jgit/errors/DiffInterruptedException.java
org.eclipse.jgit/src/org/eclipse/jgit/errors/LockFailedException.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/ServiceNotAuthorizedException.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/ServiceNotEnabledException.java

index c8d96a026343f15f8e3c88d20e6639e50ba6b548..b9f2a5617dc84d24cbac5e39cd3304384fcf7b20 100644 (file)
@@ -43,6 +43,15 @@ package org.eclipse.jgit.api.errors;
 public class RefNotFoundException extends GitAPIException {
        private static final long serialVersionUID = 1L;
 
+       /**
+        * @param message
+        * @param cause
+        * @since 4.1
+        */
+       public RefNotFoundException(String message, Throwable cause) {
+               super(message, cause);
+       }
+
        /**
         * @param message
         */
index 25d7e4d474ce4ccf3b55d00f20d38813dd49b3da..1d54f77db8d559456cdf0d11fc2b07365d46a6bf 100644 (file)
@@ -9,6 +9,15 @@ public class StashApplyFailureException extends GitAPIException {
 
        private static final long serialVersionUID = 1L;
 
+       /**
+        * @param message
+        * @param cause
+        * @since 4.1
+        */
+       public StashApplyFailureException(String message, Throwable cause) {
+               super(message, cause);
+       }
+
        /**
         * Create a StashApplyFailedException
         *
index 0990040150520cd9edcf7008025e0318573c99f3..082f94c65d54cfbde6d001b525140bb84bf2b5ad 100644 (file)
@@ -61,4 +61,13 @@ public class UnmergedPathsException extends GitAPIException {
        public UnmergedPathsException(Throwable cause) {
                super(JGitText.get().unmergedPaths, cause);
        }
+
+       /**
+        * @param message
+        * @param cause
+        * @since 4.1
+        */
+       public UnmergedPathsException(String message, Throwable cause) {
+               super(message, cause);
+       }
 }
index e6ae685c00460a2f3f0d6f7881484ca586d14460..94c8e5d1d1a72978e503f43567c2f6b8a95c3a57 100644 (file)
@@ -51,4 +51,25 @@ package org.eclipse.jgit.errors;
  */
 public class DiffInterruptedException extends RuntimeException {
        private static final long serialVersionUID = 1L;
+
+       /**
+        * @param message
+        * @param cause
+        * @since 4.1
+        */
+       public DiffInterruptedException(String message, Throwable cause) {
+               super(message, cause);
+       }
+
+       /**
+        * @param message
+        * @since 4.1
+        */
+       public DiffInterruptedException(String message) {
+               super(message);
+       }
+
+       public DiffInterruptedException() {
+               super();
+       }
 }
index 18aa9d978a5ce22f0201d51b1dd3e1dbb53b2e7e..0142e17635072d323d29a3af38b0a33cc7103acc 100644 (file)
@@ -56,6 +56,20 @@ public class LockFailedException extends IOException {
 
        private File file;
 
+       /**
+        * @param file
+        *            file that could not be locked
+        * @param message
+        *            exception message
+        * @param cause
+        *            cause, for later retrieval by {@link Throwable#getCause()}
+        * @since 4.1
+        */
+       public LockFailedException(File file, String message, Throwable cause) {
+               super(message, cause);
+               this.file = file;
+       }
+
        /**
         * Construct a CannotLockException for the given file and message
         *
index 3c16556b4196319d532999d3921b2ad99e5a165e..a9e3e42eddd7d16b7a0fdf729a529d3ec160044c 100644 (file)
@@ -55,6 +55,23 @@ import org.eclipse.jgit.internal.JGitText;
 public class ServiceNotAuthorizedException extends Exception {
        private static final long serialVersionUID = 1L;
 
+       /**
+        * @param message
+        * @param cause
+        * @since 4.1
+        */
+       public ServiceNotAuthorizedException(String message, Throwable cause) {
+               super(message, cause);
+       }
+
+       /**
+        * @param message
+        * @since 4.1
+        */
+       public ServiceNotAuthorizedException(String message) {
+               super(message);
+       }
+
        public ServiceNotAuthorizedException() {
                super(JGitText.get().unauthorized);
        }
index d0fa758a8c7fb395e815db0447562c47c84b9001..78ae303ed06a6f787f6b0cbb2497c03ffb7e64af 100644 (file)
@@ -49,6 +49,23 @@ import org.eclipse.jgit.internal.JGitText;
 public class ServiceNotEnabledException extends Exception {
        private static final long serialVersionUID = 1L;
 
+       /**
+        * @param message
+        * @param cause
+        * @since 4.1
+        */
+       public ServiceNotEnabledException(String message, Throwable cause) {
+               super(message, cause);
+       }
+
+       /**
+        * @param message
+        * @since 4.1
+        */
+       public ServiceNotEnabledException(String message) {
+               super(message);
+       }
+
        /** Indicates the request service is not available. */
        public ServiceNotEnabledException() {
                super(JGitText.get().serviceNotEnabledNoName);