ignore groupchat invitations from contacts that are not in roster if ignore_unknown_c...
[gajim.git] / src / command_system / errors.py
blobd3b29e85ec607d40a0c27a0236325a539fbeafd7
1 # Copyright (C) 2009-2010 Alexander Cherniuk <ts33kr@gmail.com>
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 class BaseError(Exception):
17 """
18 Common base for errors which relate to a specific command.
19 Encapsulates everything needed to identify a command, by either its
20 object or name.
21 """
23 def __init__(self, message, command=None, name=None):
24 self.message = message
26 self.command = command
27 self.name = name
29 if command and not name:
30 self.name = command.first_name
32 super(BaseError, self).__init__()
34 def __str__(self):
35 return self.message
37 class DefinitionError(BaseError):
38 """
39 Used to indicate errors occured on command definition.
40 """
41 pass
43 class CommandError(BaseError):
44 """
45 Used to indicate errors occured during command execution.
46 """
47 pass
49 class NoCommandError(BaseError):
50 """
51 Used to indicate an inability to find the specified command.
52 """
53 pass