[fix] Add better error reporting from EvMenu
This commit is contained in:
parent
2d791252e3
commit
2c2bd127b8
2 changed files with 8 additions and 3 deletions
|
|
@ -182,7 +182,8 @@ _CMD_NOINPUT = cmdhandler.CMD_NOINPUT
|
||||||
|
|
||||||
# i18n
|
# i18n
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
_ERR_NOT_IMPLEMENTED = _("Menu node '{nodename}' is not implemented. Make another choice.")
|
_ERR_NOT_IMPLEMENTED = _("Menu node '{nodename}' is either not implemented or "
|
||||||
|
"caused an error. Make another choice.")
|
||||||
_ERR_GENERAL = _("Error in menu node '{nodename}'.")
|
_ERR_GENERAL = _("Error in menu node '{nodename}'.")
|
||||||
_ERR_NO_OPTION_DESC = _("No description.")
|
_ERR_NO_OPTION_DESC = _("No description.")
|
||||||
_HELP_FULL = _("Commands: <menu option>, help, quit")
|
_HELP_FULL = _("Commands: <menu option>, help, quit")
|
||||||
|
|
@ -573,6 +574,7 @@ class EvMenu(object):
|
||||||
except EvMenuError:
|
except EvMenuError:
|
||||||
errmsg = _ERR_GENERAL.format(nodename=callback)
|
errmsg = _ERR_GENERAL.format(nodename=callback)
|
||||||
self.caller.msg(errmsg, self._session)
|
self.caller.msg(errmsg, self._session)
|
||||||
|
logger.log_trace()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
@ -606,9 +608,11 @@ class EvMenu(object):
|
||||||
nodetext, options = ret, None
|
nodetext, options = ret, None
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.caller.msg(_ERR_NOT_IMPLEMENTED.format(nodename=nodename), session=self._session)
|
self.caller.msg(_ERR_NOT_IMPLEMENTED.format(nodename=nodename), session=self._session)
|
||||||
|
logger.log_trace()
|
||||||
raise EvMenuError
|
raise EvMenuError
|
||||||
except Exception:
|
except Exception:
|
||||||
self.caller.msg(_ERR_GENERAL.format(nodename=nodename), session=self._session)
|
self.caller.msg(_ERR_GENERAL.format(nodename=nodename), session=self._session)
|
||||||
|
logger.log_trace()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
# store options to make them easier to test
|
# store options to make them easier to test
|
||||||
|
|
|
||||||
|
|
@ -754,12 +754,13 @@ def _node_check_desc(caller, desc):
|
||||||
|
|
||||||
|
|
||||||
def node_desc(caller):
|
def node_desc(caller):
|
||||||
|
|
||||||
metaprot = _get_menu_metaprot(caller)
|
metaprot = _get_menu_metaprot(caller)
|
||||||
text = ["|cDescribe|n briefly the prototype for viewing in listings."]
|
text = ["|cDescribe|n briefly the prototype for viewing in listings."]
|
||||||
desc = metaprot.desc
|
desc = metaprot.desc
|
||||||
|
|
||||||
if desc:
|
if desc:
|
||||||
text.append("The current desc is:\n\"|y{desc}|n\"".format(desc))
|
text.append("The current desc is:\n\"|y{desc}|n\"".format(desc=desc))
|
||||||
else:
|
else:
|
||||||
text.append("Description is currently unset.")
|
text.append("Description is currently unset.")
|
||||||
text = "\n".join(text)
|
text = "\n".join(text)
|
||||||
|
|
@ -788,7 +789,7 @@ def node_tags(caller):
|
||||||
tags = metaprot.tags
|
tags = metaprot.tags
|
||||||
|
|
||||||
if tags:
|
if tags:
|
||||||
text.append("The current tags are:\n|y{tags}|n".format(tags))
|
text.append("The current tags are:\n|y{tags}|n".format(tags=tags))
|
||||||
else:
|
else:
|
||||||
text.append("No tags are currently set.")
|
text.append("No tags are currently set.")
|
||||||
text = "\n".join(text)
|
text = "\n".join(text)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue