mirror of
https://github.com/evennia/evennia.git
synced 2026-03-23 08:16:30 +01:00
Made cmdsethandler report syntax-errors in a more informative way.
This commit is contained in:
parent
df85edc295
commit
39def4efa9
1 changed files with 9 additions and 6 deletions
|
|
@ -103,7 +103,7 @@ def import_cmdset(path, cmdsetobj, emit_to_obj=None, no_logging=False):
|
|||
"""
|
||||
|
||||
python_paths = [path] + ["%s.%s" % (prefix, path)
|
||||
for prefix in _CMDSET_PATHS]
|
||||
for prefix in _CMDSET_PATHS if not path.startswith(prefix)]
|
||||
errstring = ""
|
||||
for python_path in python_paths:
|
||||
try:
|
||||
|
|
@ -123,16 +123,19 @@ def import_cmdset(path, cmdsetobj, emit_to_obj=None, no_logging=False):
|
|||
cmdsetclass = cmdsetclass(cmdsetobj)
|
||||
return cmdsetclass
|
||||
|
||||
except ImportError:
|
||||
errstring += _("Error loading cmdset: Couldn't import module '%s'.")
|
||||
errstring = errstring % modulepath
|
||||
except ImportError, e:
|
||||
errstring += _("Error loading cmdset: Couldn't import module '%s': %s.")
|
||||
errstring = errstring % (modulepath, e)
|
||||
except KeyError:
|
||||
errstring += _("Error in loading cmdset: No cmdset class '%(classname)s' in %(modulepath)s.")
|
||||
errstring = errstring % {"classname": classname,
|
||||
"modulepath": modulepath}
|
||||
except SyntaxError, e:
|
||||
errstring += _("SyntaxError encountered when loading cmdset '%s': %s.")
|
||||
errstring = errstring % (modulepath, e)
|
||||
except Exception:
|
||||
errstring += _("Compile/Run error when loading cmdset '%s'. Error was logged.")
|
||||
errstring = errstring % (python_path)
|
||||
errstring += _("Compile/Run error when loading cmdset '%s': %s.")
|
||||
errstring = errstring % (python_path, e)
|
||||
|
||||
if errstring:
|
||||
# returning an empty error cmdset
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue