| 1 | ## exceptions.py |
|---|
| 2 | ## |
|---|
| 3 | ## Copyright (C) 2005-2006 Yann Le Boulanger <asterix@lagaule.org> |
|---|
| 4 | ## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com> |
|---|
| 5 | ## |
|---|
| 6 | ## This program is free software; you can redistribute it and/or modify |
|---|
| 7 | ## it under the terms of the GNU General Public License as published |
|---|
| 8 | ## by the Free Software Foundation; version 2 only. |
|---|
| 9 | ## |
|---|
| 10 | ## This program is distributed in the hope that it will be useful, |
|---|
| 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | ## GNU General Public License for more details. |
|---|
| 14 | ## |
|---|
| 15 | |
|---|
| 16 | class PysqliteNotAvailable(Exception): |
|---|
| 17 | '''sqlite2 is not installed or python bindings are missing''' |
|---|
| 18 | def __init__(self): |
|---|
| 19 | Exception.__init__(self) |
|---|
| 20 | |
|---|
| 21 | def __str__(self): |
|---|
| 22 | return _('pysqlite2 (aka python-pysqlite2) dependency is missing. Exiting...') |
|---|
| 23 | |
|---|
| 24 | class PysqliteOperationalError(Exception): |
|---|
| 25 | '''sqlite2 raised pysqlite2.dbapi2.OperationalError''' |
|---|
| 26 | def __init__(self, text=''): |
|---|
| 27 | Exception.__init__(self) |
|---|
| 28 | self.text = text |
|---|
| 29 | |
|---|
| 30 | def __str__(self): |
|---|
| 31 | return self.text |
|---|
| 32 | |
|---|
| 33 | class ServiceNotAvailable(Exception): |
|---|
| 34 | '''This exception is raised when we cannot use Gajim remotely''' |
|---|
| 35 | def __init__(self): |
|---|
| 36 | Exception.__init__(self) |
|---|
| 37 | |
|---|
| 38 | def __str__(self): |
|---|
| 39 | return _('Service not available: Gajim is not running, or remote_control is False') |
|---|
| 40 | |
|---|
| 41 | class DbusNotSupported(Exception): |
|---|
| 42 | '''D-Bus is not installed or python bindings are missing''' |
|---|
| 43 | def __init__(self): |
|---|
| 44 | Exception.__init__(self) |
|---|
| 45 | |
|---|
| 46 | def __str__(self): |
|---|
| 47 | return _('D-Bus is not present on this machine or python module is missing') |
|---|
| 48 | |
|---|
| 49 | class SessionBusNotPresent(Exception): |
|---|
| 50 | '''This exception indicates that there is no session daemon''' |
|---|
| 51 | def __init__(self): |
|---|
| 52 | Exception.__init__(self) |
|---|
| 53 | |
|---|
| 54 | def __str__(self): |
|---|
| 55 | return _('Session bus is not available.\nTry reading http://trac.gajim.org/wiki/GajimDBus') |
|---|
| 56 | |
|---|
| 57 | class GajimGeneralException(Exception): |
|---|
| 58 | '''This exception ir our general exception''' |
|---|
| 59 | def __init__(self, text=''): |
|---|
| 60 | Exception.__init__(self) |
|---|
| 61 | self.text = text |
|---|
| 62 | |
|---|
| 63 | def __str__(self): |
|---|
| 64 | return self.text |
|---|