+ def __unicode__(self):
+ return u'Error in command "%s".' % u' '.join(self.command)
+
+class WrongArgumentsError(CommandError):
+ r"""WrongArgumentsError() -> WrongArgumentsError instance.
+
+ This exception is raised when an empty command string is received.
+ """
+
+ def __init__(self, message):
+ r"Initialize the object, see class documentation for more info."
+ self.message = message
+
+ def __unicode__(self):
+ return self.message
+
+class CommandNotSpecifiedError(CommandError):
+ r"""CommandNotSpecifiedError() -> CommandNotSpecifiedError instance.
+
+ This exception is raised when an empty command string is received.
+ """
+
+ def __init__(self):
+ r"Initialize the object, see class documentation for more info."
+ pass
+
+ def __unicode__(self):
+ return u'Command not specified.'
+
+class CommandIsAHandlerError(CommandError):
+ r"""CommandIsAHandlerError() -> CommandIsAHandlerError instance.
+
+ This exception is raised when a command is a handler containing commands
+ instead of a command itself.
+ """
+
+ def __unicode__(self):
+ command = ' '.join(self.command)
+ return u'"%s" is a handler, not a command (type "%s help" for help).' \
+ % (command, command)
+
+class CommandNotInHandlerError(CommandError):
+ r"""CommandNotInHandlerError() -> CommandNotInHandlerError instance.
+
+ This exception is raised when a command parent is a hanlder containing
+ commands, but the command itself is not found.
+ """
+
+ def __unicode__(self):
+ return u'Command "%(c)s" not found in handler "%(h)s" ' \
+ u'(type "%(h)s help" for help).' \
+ % dict(c=u' '.join(self.command[-1:]),
+ h=u' '.join(self.command[0:-1]))