mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-24 10:50:14 +08:00
Add internal ByteReadPacket.debugPrintIfFail
This commit is contained in:
parent
f30c35bd84
commit
69532e0e57
@ -54,6 +54,17 @@ internal fun ByteReadPacket.debugPrint(name: String = ""): ByteReadPacket {
|
|||||||
return bytes.toReadPacket()
|
return bytes.toReadPacket()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("Low efficiency, only for debug purpose", ReplaceWith("this"))
|
||||||
|
internal inline fun <R> ByteReadPacket.debugPrintIfFail(name: String = "", block: ByteReadPacket.() -> R): R {
|
||||||
|
val bytes = this.readBytes()
|
||||||
|
try {
|
||||||
|
return block(bytes.toReadPacket())
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
DebugLogger.debug("Error in ByteReadPacket $name=" + bytes.toUHexString())
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated("Low efficiency, only for debug purpose", ReplaceWith("this"))
|
@Deprecated("Low efficiency, only for debug purpose", ReplaceWith("this"))
|
||||||
internal fun ByteReadPacket.debugColorizedPrint(name: String = "", ignoreUntilFirstConst: Boolean = false): ByteReadPacket {
|
internal fun ByteReadPacket.debugColorizedPrint(name: String = "", ignoreUntilFirstConst: Boolean = false): ByteReadPacket {
|
||||||
val bytes = this.readBytes()
|
val bytes = this.readBytes()
|
||||||
|
Loading…
Reference in New Issue
Block a user