Skip to content

Commit 541ef2d

Browse files
committed
Add logging to client response chunk handling
1 parent 1e814cf commit 541ef2d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

rest/jetty/src/main/scala/io/udash/rest/jetty/JettyRestClient.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package rest.jetty
44
import com.avsystem.commons.*
55
import com.avsystem.commons.annotation.explicitGenerics
66
import com.avsystem.commons.serialization.json.{JsonReader, JsonStringInput}
7+
import com.typesafe.scalalogging.LazyLogging
78
import io.udash.rest.raw.*
89
import io.udash.rest.util.Utils
910
import io.udash.utils.URLEncoder
@@ -36,7 +37,7 @@ final class JettyRestClient(
3637
client: HttpClient,
3738
defaultMaxResponseLength: Int = JettyRestClient.DefaultMaxResponseLength,
3839
defaultTimeout: Duration = JettyRestClient.DefaultTimeout,
39-
) {
40+
) extends LazyLogging {
4041

4142
@explicitGenerics
4243
def create[RestApi: RawRest.AsRealRpc : RestMetadata](
@@ -145,6 +146,11 @@ final class JettyRestClient(
145146
case Ack.Continue => demander.run()
146147
case Ack.Stop => ()
147148
}
149+
.onCompleteNow {
150+
case Failure(ex) =>
151+
logger.error("Unexpected error while processing streamed response chunk", ex)
152+
case Success(_) =>
153+
}
148154
}
149155

150156
override def onComplete(result: Result): Unit =

0 commit comments

Comments
 (0)