From 49c6734722fe0dc54247c9aadae3c7598984caf5 Mon Sep 17 00:00:00 2001 From: Him188 Date: Mon, 16 Aug 2021 19:48:19 +0800 Subject: [PATCH] Fix `ParseErrorPacket` not logged --- .../kotlin/network/components/PacketLoggingStrategy.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/network/components/PacketLoggingStrategy.kt b/mirai-core/src/commonMain/kotlin/network/components/PacketLoggingStrategy.kt index b02e9a410..0bfc637ad 100644 --- a/mirai-core/src/commonMain/kotlin/network/components/PacketLoggingStrategy.kt +++ b/mirai-core/src/commonMain/kotlin/network/components/PacketLoggingStrategy.kt @@ -53,9 +53,6 @@ internal class PacketLoggingStrategyImpl( onRight = { packet -> packet ?: return if (!bot.logger.isEnabled && !logger.isEnabled) return - if (packet is ParseErrorPacket) { - packet.direction.getLogger(bot).error("Exception on parsing packet.", packet.error) - } if (packet is MultiPacket) { if (packet.isMeaningful) logReceivedImpl(packet, incomingPacket, logger) @@ -71,6 +68,9 @@ internal class PacketLoggingStrategyImpl( private fun logReceivedImpl(packet: Packet, incomingPacket: IncomingPacket, logger: MiraiLogger) { when (packet) { + is ParseErrorPacket -> { + packet.direction.getLogger(bot).error("Exception on parsing packet.", packet.error) + } is MessageEvent -> packet.logMessageReceived() is Packet.NoLog -> { // nothing to do