mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-07-16 08:55:18 +00:00
collects all literal decode errors falling through the logging cracks
This commit is contained in:
parent
a2134d820b
commit
284715d9a1
3 changed files with 18 additions and 7 deletions
|
|
@ -98,8 +98,9 @@ object ObjectCreateBase {
|
|||
}
|
||||
} catch {
|
||||
case ex: Exception =>
|
||||
log.error(s"Decoding error - ${ex.getClass.toString} - ${ex.toString} ($objectClass)")
|
||||
Attempt.failure(Err(ex.getMessage))
|
||||
val msg = s"Decoding error - ${ex.toString} ($objectClass)"
|
||||
log.error(msg)
|
||||
Attempt.failure(Err(msg))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ object DecodePackets {
|
|||
//delete just the files that were created (if files were overwrote, nothing we can do)
|
||||
val (deleteThese, _) = filesWithSameNameAs(
|
||||
files,
|
||||
getAllFilePathsFromDirectory(tmpFolder.getAbsolutePath).map(_.toFile)
|
||||
getAllFilePathsFromDirectory(tmpFolder.getAbsolutePath).toIndexedSeq.map(_.toFile)
|
||||
)
|
||||
deleteThese.foreach(FileUtils.forceDelete)
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ object DecodePackets {
|
|||
*/
|
||||
private def filesWithSameNameInDirectory(directory: String, files: Seq[File]): (Seq[File], Seq[File]) = {
|
||||
filesWithSameNameAs(
|
||||
getAllFilePathsFromDirectory(directory).map(_.toFile),
|
||||
getAllFilePathsFromDirectory(directory).toIndexedSeq.map(_.toFile),
|
||||
files
|
||||
)
|
||||
}
|
||||
|
|
@ -327,8 +327,9 @@ object DecodePackets {
|
|||
if (i == 0) writer.write("> ")
|
||||
else writer.write("-")
|
||||
}
|
||||
val nextDecodedLine = decodePacket(header="", packet).text
|
||||
writer.write(nextDecodedLine)
|
||||
val nextDecoded = decodePacket(decodedLine, packet)
|
||||
val nextDecodedLine = nextDecoded.text
|
||||
writer.write(nextDecoded)
|
||||
writer.newLine()
|
||||
if (isNestedPacket(nextDecodedLine)) {
|
||||
linesToSkip += recursivelyHandleNestedPacket(nextDecodedLine, writer, depth + 1)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,13 @@ final case class DecodeErrorWriter(directoryPath: String, fileName: String)
|
|||
private val log: DecodeWriter = DecodeWriter(directoryPath, fileName)
|
||||
private val errorLog: DecodeWriter = DecodeWriter(directoryPath, fileName+".error")
|
||||
|
||||
def write(str: String): Unit = log.write(str)
|
||||
def write(str: String): Unit = {
|
||||
log.write(str)
|
||||
if (str.contains("Decoding error")) {
|
||||
errorLog.write(str)
|
||||
errorLog.newLine()
|
||||
}
|
||||
}
|
||||
|
||||
def write(data: PacketOutput): Unit = {
|
||||
log.write(data)
|
||||
|
|
@ -46,6 +52,9 @@ final case class DecodeErrorWriter(directoryPath: String, fileName: String)
|
|||
case error: DecodeError =>
|
||||
errorLog.write(error)
|
||||
errorLog.newLine()
|
||||
case result if result.text.contains("Decoding error") =>
|
||||
errorLog.write(data)
|
||||
errorLog.newLine()
|
||||
case _ => ()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue