Skip to content

Commit 6f354f3

Browse files
committed
Improve long error messages when connecting
1 parent 2972fe6 commit 6f354f3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,12 @@ class CoderWorkspacesStepView(val setNextButtonEnabled: (Boolean) -> Unit) : Cod
482482

483483
tableOfWorkspaces.setEmptyState("Connected to $deploymentURL")
484484
} catch (e: Exception) {
485-
val errorSummary = e.message ?: "No reason was provided"
485+
// These errors can be quite long with cascading reasons split
486+
// by colons so just take the first one otherwise they will
487+
// scroll off the edge as the empty state label does not wrap.
488+
// Users can still see the full error by using the error bubble
489+
// in the bottom right corner.
490+
val errorSummary = e.message?.substringBefore(":") ?: "No reason was provided"
486491
var msg = CoderGatewayBundle.message(
487492
"gateway.connector.view.workspaces.connect.failed",
488493
deploymentURL,

src/main/resources/messages/CoderGatewayBundle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ gateway.connector.view.coder.workspaces.unsupported.coder.version=Coder version
2323
gateway.connector.view.workspaces.connect.unauthorized=Token was rejected by {0}; has your token expired?
2424
gateway.connector.view.workspaces.connect.timeout=Unable to connect to {0}; is it up?
2525
gateway.connector.view.workspaces.connect.download-failed=Failed to download Coder CLI from {0}: {1}
26-
gateway.connector.view.workspaces.connect.failed=Failed to configure connection to {0}: {1}
26+
gateway.connector.view.workspaces.connect.failed=Failed to connect to {0}: {1}
2727
gateway.connector.view.workspaces.token.comment=The last used token is shown above.
2828
gateway.connector.view.workspaces.token.rejected=This token was rejected.
2929
gateway.connector.view.workspaces.token.injected=This token was pulled from your CLI config.

0 commit comments

Comments
 (0)