Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package software.aws.toolkits.jetbrains.core.credentials
import com.intellij.openapi.Disposable
import com.intellij.openapi.components.service
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.project.Project
import migration.software.aws.toolkits.jetbrains.services.telemetry.TelemetryService
import software.amazon.awssdk.services.ssooidc.model.SsoOidcException
Expand Down Expand Up @@ -259,18 +260,21 @@ fun reauthConnectionIfNeeded(
}
} catch (e: Exception) {
if (isReAuth) {
val result = if (e is ProcessCanceledException) Result.Cancelled else Result.Failed
recordLoginWithBrowser(
credentialStartUrl = startUrl,
credentialSourceId = getCredentialIdForTelemetry(connection),
isReAuth = true,
result = Result.Failed
result = result
)
recordAddConnection(
credentialSourceId = getCredentialIdForTelemetry(connection),
isReAuth = true,
result = Result.Failed
result = result
)
}

throw e
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import java.time.Duration
import java.util.Timer
import java.util.TimerTask
import java.util.concurrent.CancellationException
import java.util.concurrent.Future
import java.util.function.Function

Expand Down Expand Up @@ -368,14 +369,11 @@
}

protected fun isUserCancellation(e: Exception): Boolean {
if (e !is ProcessCanceledException ||
e.cause !is IllegalStateException ||
e.message?.contains(AwsCoreBundle.message("credentials.pending.user_cancel.message")) == false
) {
return false
if (e is ProcessCanceledException || e is CancellationException) {
LOG.debug(e) { "User canceled login" }
return true

Check warning on line 374 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/webview/LoginBrowser.kt

View check run for this annotation

Codecov / codecov/patch

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/webview/LoginBrowser.kt#L373-L374

Added lines #L373 - L374 were not covered by tests
}
LOG.debug(e) { "User canceled login" }
return true
return false

Check warning on line 376 in plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/webview/LoginBrowser.kt

View check run for this annotation

Codecov / codecov/patch

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/core/webview/LoginBrowser.kt#L376

Added line #L376 was not covered by tests
}

companion object {
Expand Down
Loading