mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-30 22:05:19 +00:00
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>
This commit is contained in:
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Some classes of errors would be swallowed by an unhelpful 'Invalid remote: origin' message
|
||||
|
||||
## [1.12.0] - 2020-09-24
|
||||
|
||||
### Added
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user