markusthoemmes commented on a change in pull request #4403: Add detailed error
and reason information to status code
URL:
https://github.com/apache/incubator-openwhisk/pull/4403#discussion_r270840574
##########
File path:
common/scala/src/main/scala/org/apache/openwhisk/http/PoolingRestClient.scala
##########
@@ -110,9 +110,16 @@ class PoolingRestClient(
if (response.status.isSuccess) {
Unmarshal(response.entity.withoutSizeLimit).to[T].map(Right.apply)
} else {
- // This is important, as it drains the entity stream.
- // Otherwise the connection stays open and the pool dries up.
- response.discardEntityBytes().future.map(_ => Left(response.status))
+ Unmarshal(response.entity).to[String].flatMap { errorDetails =>
+ val statusCode = response.status
+ val statusCodeReason = statusCode.reason()
+ val customReason = s"$statusCodeReason (details:$errorDetails)"
Review comment:
I'd call out that `details:` is actually the response's `body:`. Also please
add a space char for good measure.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services