]> source.dussan.org Git - jgit.git/commitdiff
Add constructors that take Throwable to ServiceMayNotContinueException. 35/17135/4
authorColby Ranger <cranger@google.com>
Mon, 7 Oct 2013 21:14:01 +0000 (14:14 -0700)
committerColby Ranger <cranger@google.com>
Mon, 7 Oct 2013 21:31:06 +0000 (17:31 -0400)
ServiceMayNotContinueException usually wraps an underlying exception.
Add convenience constructors that take Throwable. In the case a
string is not provided, the message defaults to "internal server error",
since it may be reported to the client.

Change-Id: I15dc20306826c352f69e88afb7ed6927c12b6c1f

org.eclipse.jgit/src/org/eclipse/jgit/transport/ServiceMayNotContinueException.java

index 86f6446827a30c9d9361d22c1329bf91e73c1939..fde23b3fa7fbb797fa37d173176dd29587ddb66b 100644 (file)
@@ -45,6 +45,8 @@ package org.eclipse.jgit.transport;
 
 import java.io.IOException;
 
+import org.eclipse.jgit.internal.JGitText;
+
 /**
  * Indicates a transport service may not continue execution.
  *
@@ -69,6 +71,27 @@ public class ServiceMayNotContinueException extends IOException {
                super(msg);
        }
 
+       /**
+        * @param msg
+        *            a message explaining why it cannot continue. This message may
+        *            be shown to an end-user.
+        * @param cause
+        *            the cause of the exception.
+        */
+       public ServiceMayNotContinueException(String msg, Throwable cause) {
+               super(msg, cause);
+       }
+
+       /**
+        * Initialize with an "internal server error" message and a cause.
+        *
+        * @param cause
+        *            the cause of the exception.
+        */
+       public ServiceMayNotContinueException(Throwable cause) {
+               super(JGitText.get().internalServerError, cause);
+       }
+
        /** @return true if the message was already output to the client. */
        public boolean isOutput() {
                return output;