You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
context.logger.warn("$workspaceName from $deploymentURL is not started and autostart is disabled.")
84
-
context.showInfoPopup(
85
-
context.i18n.pnotr("$workspaceName is not running"),
86
-
context.i18n.ptrl("Can't handle URI because workspace is not running and autostart is disabled. Please start the workspace manually and execute the URI again."),
87
-
context.i18n.ptrl("OK")
88
-
)
89
-
return
90
-
}
91
-
92
-
try {
93
-
restClient.startWorkspace(workspace)
94
-
} catch (e:Exception) {
95
-
context.logger.error(
96
-
e,
97
-
"$workspaceName from $deploymentURL could not be started while handling URI"
98
-
)
99
-
context.showErrorPopup(MissingArgumentException("Can't handle URI because an error was encountered while trying to start workspace $workspaceName"))
100
-
return
101
-
}
102
-
if (restClient.waitForReady(workspace) !=true) {
103
-
context.logger.error("$workspaceName from $deploymentURL could not be started on time")
104
-
context.showErrorPopup(MissingArgumentException("Can't handle URI because workspace $workspaceName could not be started on time"))
context.logger.error("Unable to connect to $workspaceName from $deploymentURL")
111
-
context.showErrorPopup(MissingArgumentException("Can't handle URI because because we're unable to connect to workspace $workspaceName"))
112
-
return
113
-
}
114
-
115
-
WorkspaceStatus.RUNNING->Unit// All is well
116
-
}
117
-
118
-
// TODO: Show a dropdown and ask for an agent if missing.
119
-
val agent:WorkspaceAgent
120
-
try {
121
-
agent = getMatchingAgent(params, workspace)
122
-
} catch (e:IllegalArgumentException) {
123
-
context.logger.error(e, "Can't resolve an agent for workspace $workspaceName from $deploymentURL")
124
-
context.showErrorPopup(
125
-
MissingArgumentException(
126
-
"Can't handle URI because we can't resolve an agent for workspace $workspaceName from $deploymentURL",
127
-
e
128
-
)
129
-
)
130
-
return
131
-
}
132
-
val status =WorkspaceAndAgentStatus.from(workspace, agent)
133
-
134
-
if (!status.ready()) {
135
-
context.logger.error("Agent ${agent.name} for workspace $workspaceName from $deploymentURL is not ready")
136
-
context.showErrorPopup(MissingArgumentException("Can't handle URI because agent ${agent.name} for workspace $workspaceName from $deploymentURL is not ready"))
137
-
return
138
-
}
65
+
if (!prepareWorkspace(workspace, restClient, workspaceName, deploymentURL)) return
66
+
if (!ensureAgentIsReady(workspace, agent)) return
139
67
140
68
val cli = ensureCLI(
141
69
context,
@@ -150,7 +78,7 @@ open class CoderProtocolHandler(
0 commit comments