Skip to content

Commit d885c60

Browse files
committed
fix: resiliency when REST call to start the workspace fail
- catches the exception, logs the errors and pops-up an error dialog during URI handling - previously the call failed silently (for example when the workspace is stopped and out of date)
1 parent a104721 commit d885c60

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt

+10-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,16 @@ open class CoderProtocolHandler(
9898
return
9999
}
100100

101-
restClient.startWorkspace(workspace)
101+
try {
102+
restClient.startWorkspace(workspace)
103+
} catch (e: Exception) {
104+
context.logger.error(
105+
e,
106+
"$workspaceName from $deploymentURL could not be started while handling URI"
107+
)
108+
context.showErrorPopup(MissingArgumentException("Can't handle URI because an error was encountered while trying to start workspace $workspaceName"))
109+
return
110+
}
102111
if (restClient.waitForReady(workspace) != true) {
103112
context.logger.error("$workspaceName from $deploymentURL could not be started on time")
104113
context.showErrorPopup(MissingArgumentException("Can't handle URI because workspace $workspaceName could not be started on time"))

0 commit comments

Comments
 (0)