Skip to content

Commit

Permalink
Added try-catch block to handle potential exceptions and improve stab…
Browse files Browse the repository at this point in the history
…ility.
  • Loading branch information
yurizhuk committed Aug 7, 2024
1 parent 6ab7e92 commit 48b24a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mobile-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ afterEvaluate {

groupId = "com.webitel"
artifactId = "mobile-sdk"
version = "0.15.1"
version = "0.15.2"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,18 @@ internal class WebitelChat(
while (transferRequest.stream.read(fiveKB).also { length = it } > 0) {
if (!inProcess) break
logger.debug("sendFile", "sending $length length of data")
request?.onNext(
Media.UploadRequest.newBuilder()
.setPart(ByteString.copyFrom(fiveKB, 0, length))
.build()
)

try {
request?.onNext(
Media.UploadRequest.newBuilder()
.setPart(ByteString.copyFrom(fiveKB, 0, length))
.build()
)
} catch (e: Exception) {
inProcess = false
logger.error("upload chunk", e.message.toString())
}

}
logger.debug("sendFile", "all bytes sent to stream")
if (inProcess) {
Expand Down

0 comments on commit 48b24a8

Please sign in to comment.