From 7a4a257b517a0e0de192668b192a33a0987268bf Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 27 Mar 2012 14:57:42 -0400 Subject: [PATCH] Added better error related log lines for corrupt chunks --- overviewer_core/tileset.py | 2 +- overviewer_core/world.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/overviewer_core/tileset.py b/overviewer_core/tileset.py index b9a9dd6..d6a6d69 100644 --- a/overviewer_core/tileset.py +++ b/overviewer_core/tileset.py @@ -942,7 +942,7 @@ class TileSet(object): except nbt.CorruptionError: # A warning and traceback was already printed by world.py's # get_chunk() - logging.debug("Skipping corrupt chunk at %s,%s", chunkx, chunkz) + logging.debug("Skipping the render of corrupt chunk at %s,%s and moving on.", chunkx, chunkz) except Exception, e: logging.warning("Could not render chunk %s,%s for some reason. I'm going to ignore this and continue", chunkx, chunkz) logging.debug("Full error was:", exc_info=1) diff --git a/overviewer_core/world.py b/overviewer_core/world.py index 5ade124..594efd7 100644 --- a/overviewer_core/world.py +++ b/overviewer_core/world.py @@ -289,7 +289,7 @@ class RegionSet(object): self.regioncache[regionfilename] = region return region - @log_other_exceptions + #@log_other_exceptions def get_chunk(self, x, z): """Returns a dictionary object representing the "Level" NBT Compound structure for a chunk given its x, z coordinates. The coordinates given @@ -333,13 +333,20 @@ class RegionSet(object): # Flush the region cache to possibly read a new region file # header logging.debug("Encountered a corrupt chunk at %s,%s. Flushing cache and retrying", x, z) - logging.debug("Error was:", exc_info=1) + #logging.debug("Error was:", exc_info=1) del self.regioncache[regionfile] time.sleep(0.5) continue else: - logging.warning("Tried several times to read chunk %d,%d. Giving up.", - x, z, e) + if isinstance(e, nbt.CorruptRegionError): + logging.warning("Tried several times to read chunk %d,%d. Its region (%d,%d) may be corrupt. Giving up.", + x, z,x//32,z//32) + elif isinstance(e, nbt.CorruptChunkError): + logging.warning("Tried several times to read chunk %d,%d. It may be corrupt. Giving up.", + x, z) + else: + logging.warning("Tried several times to read chunk %d,%d. Unknown error. Giving up.", + x, z) logging.debug("Full traceback:", exc_info=1) # Let this exception propagate out through the C code into # tileset.py, where it is caught and gracefully continues