Skip to content

Commit

Permalink
chore: add logs to crypto error unpacker ProteusFailure (#2091)
Browse files Browse the repository at this point in the history
* chore: add logs to crypto error unpacker ProteusFailure (#2090)

* chore: morelogs

* chore: morelogs

* chore: morelogs

* chore: morelogs

* Empty-Commit

---------

Co-authored-by: Yamil Medina <[email protected]>
  • Loading branch information
github-actions[bot] and yamilmedina authored Sep 26, 2023
1 parent 5628a66 commit 45b6707
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.wire.kalium.cryptography.utils.AES256Key
import com.wire.kalium.cryptography.utils.EncryptedData
import com.wire.kalium.cryptography.utils.decryptDataWithAES256
import com.wire.kalium.logger.KaliumLogger
import com.wire.kalium.logger.obfuscateId
import com.wire.kalium.logic.CoreFailure
import com.wire.kalium.logic.ProteusFailure
import com.wire.kalium.logic.data.event.Event
Expand Down Expand Up @@ -75,7 +76,18 @@ internal class ProteusMessageUnpackerImpl(
.onFailure {
when (it) {
is CoreFailure.Unknown -> logger.e("UnknownFailure when processing message: $it", it.rootCause)
is ProteusFailure -> logger.e("ProteusFailure when processing message: ${it.proteusException.code.name}")

is ProteusFailure -> {
val loggableException =
"{ \"code\": \"${it.proteusException.code.name}\", \"message\": \"${it.proteusException.message}\", " +
"\"error\": \"${it.proteusException.stackTraceToString()}\"," +
"\"senderClientId\": \"${event.senderClientId.value.obfuscateId()}\"," +
"\"senderUserId\": \"${event.senderUserId.value.obfuscateId()}\"," +
"\"cryptoClientId\": \"${cryptoSessionId.cryptoClientId.value.obfuscateId()}\"," +
"\"cryptoUserId\": \"${cryptoSessionId.userId.value.obfuscateId()}\"}"
logger.e("ProteusFailure when processing message detail: $loggableException")
}

else -> logger.e("Failure when processing message: $it")
}
}.map { readableContent ->
Expand Down

0 comments on commit 45b6707

Please sign in to comment.