mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-10 07:45:05 -04:00
Add dimension to machine position debug statements
This commit is contained in:
parent
6f8bfbf188
commit
e940d5c745
@ -780,7 +780,7 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
|||||||
catch {
|
catch {
|
||||||
case t: Throwable =>
|
case t: Throwable =>
|
||||||
OpenComputers.log.error(
|
OpenComputers.log.error(
|
||||||
s"""Unexpected error loading a state of computer at (${host.xPosition}, ${host.yPosition}, ${host.zPosition}). """ +
|
s"""Unexpected error loading a state of computer at ${machinePosition}. """ +
|
||||||
s"""State: ${state.headOption.fold("no state")(_.toString)}. Unless you're upgrading/downgrading across a major version, please report this! Thank you.""", t)
|
s"""State: ${state.headOption.fold("no state")(_.toString)}. Unless you're upgrading/downgrading across a major version, please report this! Thank you.""", t)
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
@ -862,7 +862,7 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
|||||||
catch {
|
catch {
|
||||||
case t: Throwable =>
|
case t: Throwable =>
|
||||||
OpenComputers.log.error(
|
OpenComputers.log.error(
|
||||||
s"""Unexpected error saving a state of computer at (${host.xPosition}, ${host.yPosition}, ${host.zPosition}). """ +
|
s"""Unexpected error saving a state of computer at ${machinePosition}. """ +
|
||||||
s"""State: ${state.headOption.fold("no state")(_.toString)}. Unless you're upgrading/downgrading across a major version, please report this! Thank you.""", t)
|
s"""State: ${state.headOption.fold("no state")(_.toString)}. Unless you're upgrading/downgrading across a major version, please report this! Thank you.""", t)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1039,6 +1039,9 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
|||||||
// Keep track of time spent executing the computer.
|
// Keep track of time spent executing the computer.
|
||||||
cpuTotal += System.nanoTime() - cpuStart
|
cpuTotal += System.nanoTime() - cpuStart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Helper method for printing the machine position in error messages and debug statements. */
|
||||||
|
private def machinePosition = s"(${host.xPosition}, ${host.yPosition}, ${host.zPosition}, ${host.world().provider.dimensionId})"
|
||||||
}
|
}
|
||||||
|
|
||||||
object Machine extends MachineAPI {
|
object Machine extends MachineAPI {
|
||||||
|
@ -376,7 +376,7 @@ abstract class NativeLuaArchitecture(val machine: api.machine.Machine) extends A
|
|||||||
|
|
||||||
try lua.gc(LuaState.GcAction.COLLECT, 0) catch {
|
try lua.gc(LuaState.GcAction.COLLECT, 0) catch {
|
||||||
case t: Throwable =>
|
case t: Throwable =>
|
||||||
OpenComputers.log.warn(s"Error cleaning up loaded computer @ (${machine.host.xPosition}, ${machine.host.yPosition}, ${machine.host.zPosition}). This either means the server is badly overloaded or a user created an evil __gc method, accidentally or not.")
|
OpenComputers.log.warn(s"Error cleaning up loaded computer @ ${machinePosition}. This either means the server is badly overloaded or a user created an evil __gc method, accidentally or not.")
|
||||||
machine.crash("error in garbage collector, most likely __gc method timed out")
|
machine.crash("error in garbage collector, most likely __gc method timed out")
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@ -414,19 +414,22 @@ abstract class NativeLuaArchitecture(val machine: api.machine.Machine) extends A
|
|||||||
|
|
||||||
try lua.gc(LuaState.GcAction.COLLECT, 0) catch {
|
try lua.gc(LuaState.GcAction.COLLECT, 0) catch {
|
||||||
case t: Throwable =>
|
case t: Throwable =>
|
||||||
OpenComputers.log.warn(s"Error cleaning up loaded computer @ (${machine.host.xPosition}, ${machine.host.yPosition}, ${machine.host.zPosition}). This either means the server is badly overloaded or a user created an evil __gc method, accidentally or not.")
|
OpenComputers.log.warn(s"Error cleaning up loaded computer @ ${machinePosition}. This either means the server is badly overloaded or a user created an evil __gc method, accidentally or not.")
|
||||||
machine.crash("error in garbage collector, most likely __gc method timed out")
|
machine.crash("error in garbage collector, most likely __gc method timed out")
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
case e: LuaRuntimeException =>
|
case e: LuaRuntimeException =>
|
||||||
OpenComputers.log.warn(s"Could not persist computer @ (${machine.host.xPosition}, ${machine.host.yPosition}, ${machine.host.zPosition}).\n${e.toString}" + (if (e.getLuaStackTrace.isEmpty) "" else "\tat " + e.getLuaStackTrace.mkString("\n\tat ")))
|
OpenComputers.log.warn(s"Could not persist computer @ ${machinePosition}.\n${e.toString}" + (if (e.getLuaStackTrace.isEmpty) "" else "\tat " + e.getLuaStackTrace.mkString("\n\tat ")))
|
||||||
nbt.removeTag("state")
|
nbt.removeTag("state")
|
||||||
case e: LuaGcMetamethodException =>
|
case e: LuaGcMetamethodException =>
|
||||||
OpenComputers.log.warn(s"Could not persist computer @ (${machine.host.xPosition}, ${machine.host.yPosition}, ${machine.host.zPosition}).\n${e.toString}")
|
OpenComputers.log.warn(s"Could not persist computer @ ${machinePosition}.\n${e.toString}")
|
||||||
nbt.removeTag("state")
|
nbt.removeTag("state")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit memory again.
|
// Limit memory again.
|
||||||
recomputeMemory(machine.host.internalComponents)
|
recomputeMemory(machine.host.internalComponents)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Helper method for printing the machine position in error messages and debug statements. */
|
||||||
|
private def machinePosition = s"(${machine.host.xPosition}, ${machine.host.yPosition}, ${machine.host.zPosition}, ${machine.host.world().provider.dimensionId})"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user