Browse Source

Allow setting detail message and cause when constructing most exceptions

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>
stable-4.1
Jonathan Nieder 10 years ago
parent
commit
8c3fe215b4
  1. 9
      org.eclipse.jgit/src/org/eclipse/jgit/api/errors/RefNotFoundException.java
  2. 9
      org.eclipse.jgit/src/org/eclipse/jgit/api/errors/StashApplyFailureException.java
  3. 9
      org.eclipse.jgit/src/org/eclipse/jgit/api/errors/UnmergedPathsException.java
  4. 21
      org.eclipse.jgit/src/org/eclipse/jgit/errors/DiffInterruptedException.java
  5. 14
      org.eclipse.jgit/src/org/eclipse/jgit/errors/LockFailedException.java
  6. 17
      org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/ServiceNotAuthorizedException.java
  7. 17
      org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/ServiceNotEnabledException.java

9
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/RefNotFoundException.java

@ -43,6 +43,15 @@ package org.eclipse.jgit.api.errors;
public class RefNotFoundException extends GitAPIException { public class RefNotFoundException extends GitAPIException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* @param message
* @param cause
* @since 4.1
*/
public RefNotFoundException(String message, Throwable cause) {
super(message, cause);
}
/** /**
* @param message * @param message
*/ */

9
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/StashApplyFailureException.java

@ -9,6 +9,15 @@ public class StashApplyFailureException extends GitAPIException {
private static final long serialVersionUID = 1L; 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 * Create a StashApplyFailedException
* *

9
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/UnmergedPathsException.java

@ -61,4 +61,13 @@ public class UnmergedPathsException extends GitAPIException {
public UnmergedPathsException(Throwable cause) { public UnmergedPathsException(Throwable cause) {
super(JGitText.get().unmergedPaths, cause); super(JGitText.get().unmergedPaths, cause);
} }
/**
* @param message
* @param cause
* @since 4.1
*/
public UnmergedPathsException(String message, Throwable cause) {
super(message, cause);
}
} }

21
org.eclipse.jgit/src/org/eclipse/jgit/errors/DiffInterruptedException.java

@ -51,4 +51,25 @@ package org.eclipse.jgit.errors;
*/ */
public class DiffInterruptedException extends RuntimeException { public class DiffInterruptedException extends RuntimeException {
private static final long serialVersionUID = 1L; 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();
}
} }

14
org.eclipse.jgit/src/org/eclipse/jgit/errors/LockFailedException.java

@ -56,6 +56,20 @@ public class LockFailedException extends IOException {
private File file; 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 * Construct a CannotLockException for the given file and message
* *

17
org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/ServiceNotAuthorizedException.java

@ -55,6 +55,23 @@ import org.eclipse.jgit.internal.JGitText;
public class ServiceNotAuthorizedException extends Exception { public class ServiceNotAuthorizedException extends Exception {
private static final long serialVersionUID = 1L; 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() { public ServiceNotAuthorizedException() {
super(JGitText.get().unauthorized); super(JGitText.get().unauthorized);
} }

17
org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/ServiceNotEnabledException.java

@ -49,6 +49,23 @@ import org.eclipse.jgit.internal.JGitText;
public class ServiceNotEnabledException extends Exception { public class ServiceNotEnabledException extends Exception {
private static final long serialVersionUID = 1L; 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. */ /** Indicates the request service is not available. */
public ServiceNotEnabledException() { public ServiceNotEnabledException() {
super(JGitText.get().serviceNotEnabledNoName); super(JGitText.get().serviceNotEnabledNoName);

Loading…
Cancel
Save