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
Copy file name to clipboardExpand all lines: src/main/kotlin/com/coder/gateway/sdk/CoderRestClientService.kt
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,7 @@ class CoderRestClient(var url: URL, var token: String) {
75
75
funme(): User {
76
76
val userResponse = retroRestClient.me().execute()
77
77
if (!userResponse.isSuccessful) {
78
-
throwAuthenticationResponseException("Authentication to $url failed with code ${userResponse.code()}, ${userResponse.message().ifBlank { "has your token expired?" }}")
78
+
throwAuthenticationResponseException("Unable to authenticate to $url: code ${userResponse.code()}, ${userResponse.message().ifBlank { "has your token expired?" }}")
79
79
}
80
80
81
81
return userResponse.body()!!
@@ -88,7 +88,7 @@ class CoderRestClient(var url: URL, var token: String) {
88
88
funworkspaces(): List<Workspace> {
89
89
val workspacesResponse = retroRestClient.workspaces("owner:me").execute()
90
90
if (!workspacesResponse.isSuccessful) {
91
-
throwWorkspaceResponseException("Retrieving workspaces from $url failed with code ${workspacesResponse.code()}, reason: ${workspacesResponse.message().ifBlank { "no reason provided" }}")
91
+
throwWorkspaceResponseException("Unable to retrieve workspaces from $url: code ${workspacesResponse.code()}, reason: ${workspacesResponse.message().ifBlank { "no reason provided" }}")
92
92
}
93
93
94
94
return workspacesResponse.body()!!.workspaces
@@ -97,15 +97,15 @@ class CoderRestClient(var url: URL, var token: String) {
97
97
funbuildInfo(): BuildInfo {
98
98
val buildInfoResponse = retroRestClient.buildInfo().execute()
99
99
if (!buildInfoResponse.isSuccessful) {
100
-
throw java.lang.IllegalStateException("Retrieving build information for $url failed with code ${buildInfoResponse.code()}, reason:${buildInfoResponse.message().ifBlank { "no reason provided" }}")
100
+
throw java.lang.IllegalStateException("Unable to retrieve build information for $url, code:${buildInfoResponse.code()}, reason:${buildInfoResponse.message().ifBlank { "no reason provided" }}")
101
101
}
102
102
return buildInfoResponse.body()!!
103
103
}
104
104
105
105
privatefuntemplate(templateID:UUID): Template {
106
106
val templateResponse = retroRestClient.template(templateID).execute()
107
107
if (!templateResponse.isSuccessful) {
108
-
throwTemplateResponseException("Retrieving template with id$templateID from $url failed with code ${templateResponse.code()}, reason: ${templateResponse.message().ifBlank { "no reason provided" }}")
108
+
throwTemplateResponseException("Unable to retrieve template with ID$templateID from $url, code:${templateResponse.code()}, reason: ${templateResponse.message().ifBlank { "no reason provided" }}")
109
109
}
110
110
return templateResponse.body()!!
111
111
}
@@ -114,7 +114,7 @@ class CoderRestClient(var url: URL, var token: String) {
114
114
val buildRequest =CreateWorkspaceBuildRequest(null, WorkspaceTransition.START, null, null, null, null)
115
115
val buildResponse = retroRestClient.createWorkspaceBuild(workspaceID, buildRequest).execute()
116
116
if (buildResponse.code() !=HTTP_CREATED) {
117
-
throwWorkspaceResponseException("Building workspace $workspaceName on $url failed with code ${buildResponse.code()}, reason: ${buildResponse.message().ifBlank { "no reason provided" }}")
117
+
throwWorkspaceResponseException("Unable to build workspace $workspaceName on $url, code:${buildResponse.code()}, reason: ${buildResponse.message().ifBlank { "no reason provided" }}")
118
118
}
119
119
120
120
return buildResponse.body()!!
@@ -124,7 +124,7 @@ class CoderRestClient(var url: URL, var token: String) {
124
124
val buildRequest =CreateWorkspaceBuildRequest(null, WorkspaceTransition.STOP, null, null, null, null)
125
125
val buildResponse = retroRestClient.createWorkspaceBuild(workspaceID, buildRequest).execute()
126
126
if (buildResponse.code() !=HTTP_CREATED) {
127
-
throwWorkspaceResponseException("Stopping workspace $workspaceName on $url failed with code ${buildResponse.code()}, reason: ${buildResponse.message().ifBlank { "no reason provided" }}")
127
+
throwWorkspaceResponseException("Unable to stop workspace $workspaceName on $url, code:${buildResponse.code()}, reason: ${buildResponse.message().ifBlank { "no reason provided" }}")
128
128
}
129
129
130
130
return buildResponse.body()!!
@@ -136,7 +136,7 @@ class CoderRestClient(var url: URL, var token: String) {
136
136
val buildRequest =CreateWorkspaceBuildRequest(template.activeVersionID, lastWorkspaceTransition, null, null, null, null)
137
137
val buildResponse = retroRestClient.createWorkspaceBuild(workspaceID, buildRequest).execute()
138
138
if (buildResponse.code() !=HTTP_CREATED) {
139
-
throwWorkspaceResponseException("Updating workspace $workspaceName on $url failed with code ${buildResponse.code()}, reason: ${buildResponse.message().ifBlank { "no reason provided" }}")
139
+
throwWorkspaceResponseException("Unable to update workspace $workspaceName on $url, code:${buildResponse.code()}, reason: ${buildResponse.message().ifBlank { "no reason provided" }}")
0 commit comments