Handle xml parsing exceptions

This commit is contained in:
Ray 2008-09-29 09:12:04 -05:00
parent 2ccf3c6370
commit 4500f48aa7

View File

@ -25,6 +25,7 @@ Handles HUD configuration files.
# Standard Library modules
import os
import sys
import traceback
import shutil
import xml.dom.minidom
from xml.dom.minidom import Node
@ -197,8 +198,14 @@ class Config:
print "No HUD_config_xml found. Exiting"
sys.stderr.write("No HUD_config_xml found. Exiting")
sys.exit()
try:
doc = xml.dom.minidom.parse(file)
except:
print "Error parsing %s. See error log file." % (file)
traceback.print_exc(file=sys.stderr)
print "press enter to continue"
sys.stdin.readline()
sys.exit()
self.doc = doc
self.file = file