Skip to content

Commit d5f80fe

Browse files
committed
fix: show the error if there is an issue when removing the workspace
1 parent 82cca7b commit d5f80fe

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.coder.toolbox
33
import com.coder.toolbox.browser.BrowserUtil
44
import com.coder.toolbox.models.WorkspaceAndAgentStatus
55
import com.coder.toolbox.sdk.CoderRestClient
6+
import com.coder.toolbox.sdk.ex.APIResponseException
67
import com.coder.toolbox.sdk.v2.models.Workspace
78
import com.coder.toolbox.sdk.v2.models.WorkspaceAgent
89
import com.coder.toolbox.util.withPath
@@ -147,11 +148,11 @@ class CoderRemoteEnvironment(
147148
)
148149
}
149150
if (shouldDelete) {
150-
if (status.canStop()) {
151-
client.stopWorkspace(workspace)
151+
try {
152+
client.removeWorkspace(workspace)
153+
} catch (e: APIResponseException) {
154+
ui.showErrorInfoPopup(e)
152155
}
153-
154-
client.removeWorkspace(workspace)
155156
}
156157
}
157158
}

0 commit comments

Comments
 (0)