aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/com/zeapo
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-09-29 21:11:14 +0530
committerGitHub <noreply@github.com>2020-09-29 17:41:14 +0200
commitfbc9fde75e650990d7ce3e5035d53e45f6575ddb (patch)
tree051e35f029391547e7f52aff20992f2e4fd81e3a /app/src/main/java/com/zeapo
parent87d6552018aea55cb3def81a6ba974a94bff81c4 (diff)
Unwrap root cause for InvalidRemoteException (#1122)
* BaseGitActivity: unwrap root cause for InvalidRemoteException as well JGit's InvalidRemoteException, like TransportException, swallows more useful errors as is clear from this (redacted) snippet. ``` D org.eclipse.jgit.api.errors.InvalidRemoteException: Invalid remote: origin D at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:26) D at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:41) D at com.zeapo.pwdstore.git.GitCommandExecutor$execute$2$result$1.invokeSuspend(GitCommandExecutor.kt:2) D at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:3) D at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:15) D at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:1) D at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:13) D Caused by: org.eclipse.jgit.errors.NoRemoteRepositoryException: ssh://msfjarvis@[fe80::dead:beef]:22/pass-repo: fatal: '/pass-repo' does not appear to be a git repository D at org.eclipse.jgit.transport.TransportGitSsh.cleanNotFound(TransportGitSsh.java:14) D at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:20) D at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:1) D at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:1) D at org.eclipse.jgit.transport.Transport.fetch(Transport.java:20) D at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:18) ``` Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> * Add changelog entry Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com/zeapo')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt b/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt
index b0aed087..36b8b6fb 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt
@@ -128,11 +128,12 @@ abstract class BaseGitActivity : AppCompatActivity() {
*/
private fun rootCauseException(throwable: Throwable): Throwable {
var rootCause = throwable
- // JGit's TransportException hides the more helpful SSHJ exceptions.
+ // JGit's InvalidRemoteException and TransportException hide the more helpful SSHJ exceptions.
// Also, SSHJ's UserAuthException about exhausting available authentication methods hides
// more useful exceptions.
while ((rootCause is org.eclipse.jgit.errors.TransportException ||
rootCause is org.eclipse.jgit.api.errors.TransportException ||
+ rootCause is org.eclipse.jgit.api.errors.InvalidRemoteException ||
(rootCause is UserAuthException &&
rootCause.message == "Exhausted available authentication methods"))) {
rootCause = rootCause.cause ?: break