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):
18 Common base for errors which relate to a specific command.
19 Encapsulates everything needed to identify a command, by either its
23 def __init__(self
, message
, command
=None, name
=None):
24 self
.message
= message
26 self
.command
= command
29 if command
and not name
:
30 self
.name
= command
.first_name
32 super(BaseError
, self
).__init
__()
37 class DefinitionError(BaseError
):
39 Used to indicate errors occured on command definition.
43 class CommandError(BaseError
):
45 Used to indicate errors occured during command execution.
49 class NoCommandError(BaseError
):
51 Used to indicate an inability to find the specified command.