Throw invalid ref exception instead of invalid remote exception
ReflogCommand command was throwing an incorrect exception type when an IOException was wrapped and rethrown from the underlying ReflogReader. The IOException cause is now provided to the thrown exception as well. Change-Id: I9f1842c2d414d3e9c658843f9b448bc18891748e
This commit is contained in:
parent
47d1616374
commit
4535a9e2a3
|
@ -47,7 +47,7 @@
|
|||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.jgit.JGitText;
|
||||
import org.eclipse.jgit.api.errors.InvalidRemoteException;
|
||||
import org.eclipse.jgit.api.errors.InvalidRefNameException;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.storage.file.ReflogEntry;
|
||||
|
@ -91,8 +91,8 @@ public Collection<ReflogEntry> call() throws Exception {
|
|||
ReflogReader reader = new ReflogReader(repo, ref);
|
||||
return reader.getReverseEntries();
|
||||
} catch (IOException e) {
|
||||
throw new InvalidRemoteException(MessageFormat.format(
|
||||
JGitText.get().cannotRead, ref));
|
||||
throw new InvalidRefNameException(MessageFormat.format(
|
||||
JGitText.get().cannotRead, ref), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,4 +49,12 @@ public class InvalidRefNameException extends GitAPIException {
|
|||
public InvalidRefNameException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg
|
||||
* @param cause
|
||||
*/
|
||||
public InvalidRefNameException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue