Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/main/kotlin/nmcp/internal/task/publish.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fun publish(
val mark = markNow()
while (true) {
check (mark.elapsedNow() < timeout) {
"Nmcp: timeout while verifying deployment status."
"Nmcp: timeout while waiting for the deployment $deploymentId to publish. You might need to check the deployment on the Central Portal UI (see $baseUrl$), or you could increase the wait timeout (the current timeout is $timeout)."
}
when (val status = verifyStatus(
deploymentId = deploymentId,
Expand Down Expand Up @@ -149,18 +149,18 @@ private fun verifyStatus(
client.newCall(it).execute()
}.use {
if (!it.isSuccessful) {
error("Cannot verify deployment status (HTTP status='${it.code}'): ${it.body?.string()}")
error("Cannot verify deployment $deploymentId status (HTTP status='${it.code}'): ${it.body?.string()}")
}

val str = it.body!!.string()
val element = Json.parseToJsonElement(str)
check(element is JsonObject) {
"Nmcp: unexpected status response: $str"
"Nmcp: unexpected status response for deployment $deploymentId: $str"
}

val state = element["deploymentState"]
check(state is JsonPrimitive && state.isString) {
"Nmcp: unexpected deploymentState: $state"
"Nmcp: unexpected deploymentState for deployment $deploymentId: $state"
}

return when (state.content) {
Expand All @@ -172,7 +172,7 @@ private fun verifyStatus(
"FAILED" -> {
FAILED(element["errors"].toString())
}
else -> error("Nmcp: unexpected deploymentState: $state")
else -> error("Nmcp: unexpected deploymentState for deployment $deploymentId: $state")
}
}
}
Expand Down