when a second error happens during the fallback attempt, raise both errors

This commit is contained in:
David Vierra 2010-11-29 21:38:41 -10:00
parent 8716c8994b
commit bbb37dbca8

View File

@ -704,6 +704,9 @@ class MCLevel(object):
''' '''
info( u"Identifying " + filename ) info( u"Identifying " + filename )
class LoadingError(RuntimeError): pass
if not filename: if not filename:
raise IOError, "File not found: "+filename raise IOError, "File not found: "+filename
if not os.path.exists(filename): if not os.path.exists(filename):
@ -769,9 +772,12 @@ class MCLevel(object):
except Exception, e: except Exception, e:
info( u"Error during NBT load: {0!r}".format(e) ) info( u"Error during NBT load: {0!r}".format(e) )
info( u"Fallback: Detected compressed flat block array, yzx ordered " ) info( u"Fallback: Detected compressed flat block array, yzx ordered " )
try:
lev = MCJavaLevel(filename, data); lev = MCJavaLevel(filename, data);
lev.compressed = compressed; lev.compressed = compressed;
return lev; return lev;
except Exception, e2:
raise LoadingError, ("Multiple errors encountered", e, e2)
else: else:
if(MCIndevLevel._isTagLevel(root_tag)): if(MCIndevLevel._isTagLevel(root_tag)):