diff --git a/CHANGELOG.md b/CHANGELOG.md index d1aef31a..ce7e14d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Fixed - terminal link is now correct when host ends in `/` +- improved resiliency and error handling when trying to open the last successful connection ## 2.1.6-eap.0 - 2023-02-02 diff --git a/src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt b/src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt index 163edb0e..4326a246 100644 --- a/src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt +++ b/src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt @@ -321,9 +321,20 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) : try { coderClient.initClientSession(url.toURL(), token) loginAndLoadWorkspace(token) - } catch (e: AuthenticationResponseException) { - // probably the token is expired - askTokenAndOpenSession() + } catch (e: Exception) { + when (e) { + is AuthenticationResponseException -> { + // probably the token is expired + askTokenAndOpenSession() + } + + else -> { + logger.warn("An exception was encountered while opening ${localWizardModel.coderURL}. Reason: ${e.message}") + localWizardModel = CoderWorkspacesWizardModel() + tfUrl?.text = localWizardModel.coderURL + } + } + } } }