Skip to content

Commit

Permalink
Print status code only on debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
juraj-hrivnak committed Feb 23, 2024
1 parent fabe6bf commit f9212ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/commonMain/kotlin/teksturepako/pakku/api/http/Http.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ open class Http

suspend inline fun <reified T> HttpResponse.bodyIfOK(): T?
{
return if (this.status == HttpStatusCode.OK) this.body() else null.also {
println("Error: ${this::class.simpleName} HTTP request returned: ${this.status}")
return if (this.status == HttpStatusCode.OK) this.body() else null.debug {
println("Error: ${this@Http::class.simpleName} HTTP request returned: ${this.status}")
}
}
}

0 comments on commit f9212ea

Please sign in to comment.