Don't print scary traceback if the config file can't be found
This commit is contained in:
@@ -242,7 +242,12 @@ dir but you forgot to put quotes around the directory, since it contains spaces.
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
# Parse the config file
|
# Parse the config file
|
||||||
|
try:
|
||||||
mw_parser.parse(options.config)
|
mw_parser.parse(options.config)
|
||||||
|
except configParser.MissingConfigException as e:
|
||||||
|
# this isn't a "bug", so don't print scary traceback
|
||||||
|
logging.error(str(e))
|
||||||
|
util.nice_exit(1)
|
||||||
|
|
||||||
# Add in the command options here, perhaps overriding values specified in
|
# Add in the command options here, perhaps overriding values specified in
|
||||||
# the config
|
# the config
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ import traceback
|
|||||||
import settingsDefinition
|
import settingsDefinition
|
||||||
import settingsValidators
|
import settingsValidators
|
||||||
|
|
||||||
|
class MissingConfigException(Exception):
|
||||||
|
"To be thrown when the config file can't be found"
|
||||||
|
pass
|
||||||
|
|
||||||
class MultiWorldParser(object):
|
class MultiWorldParser(object):
|
||||||
"""A class that is used to parse a settings.py file.
|
"""A class that is used to parse a settings.py file.
|
||||||
|
|
||||||
@@ -68,7 +72,7 @@ class MultiWorldParser(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
if not os.path.exists(settings_file) and not os.path.isfile(settings_file):
|
if not os.path.exists(settings_file) and not os.path.isfile(settings_file):
|
||||||
raise ValueError("The settings file you specified (%r) does not exist, or is not a file" % settings_file)
|
raise MissingConfigException("The settings file you specified (%r) does not exist, or is not a file" % settings_file)
|
||||||
|
|
||||||
# The global environment should be the rendermode module, so the config
|
# The global environment should be the rendermode module, so the config
|
||||||
# file has access to those resources.
|
# file has access to those resources.
|
||||||
|
|||||||
Reference in New Issue
Block a user