Added better error reporting to cmdhandler - making a nested function to execute the command tended to hide tracebacks.

This commit is contained in:
Griatch 2015-02-20 20:20:06 +01:00
parent 6edc09411a
commit 6f9042e191

View file

@ -291,6 +291,7 @@ def cmdhandler(called_by, raw_string, _testing=False, callertype="session", sess
deferred (Deferred): this will fire when the func() method deferred (Deferred): this will fire when the func() method
returns. returns.
""" """
try:
# Assign useful variables to the instance # Assign useful variables to the instance
cmd.caller = caller cmd.caller = caller
cmd.cmdstring = cmdname cmd.cmdstring = cmdname
@ -341,6 +342,11 @@ def cmdhandler(called_by, raw_string, _testing=False, callertype="session", sess
caller.ndb.last_cmd = None caller.ndb.last_cmd = None
# return result to the deferred # return result to the deferred
returnValue(ret) returnValue(ret)
except Exception:
string = "%s\nAbove traceback is from an untrapped error."
string += " Please file a bug report."
logger.log_trace(_(string))
caller.msg(string % format_exc())
raw_string = to_unicode(raw_string, force_string=True) raw_string = to_unicode(raw_string, force_string=True)