2008-08-15 05:20:23 +02:00
|
|
|
## src/common/exceptions.py
|
2005-12-01 18:16:53 +01:00
|
|
|
##
|
2008-08-15 05:20:23 +02:00
|
|
|
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem AT gmail.com>
|
|
|
|
## Copyright (C) 2005-2008 Yann Leboulanger <asterix AT lagaule.org>
|
|
|
|
## Copyright (C) 2006 Jean-Marie Traissard <jim AT lapin.org>
|
|
|
|
## Copyright (C) 2007 Brendan Taylor <whateley AT gmail.com>
|
|
|
|
## Copyright (C) 2008 Jonathan Schleifer <js-gajim AT webkeks.org>
|
2005-12-01 18:16:53 +01:00
|
|
|
##
|
2007-10-22 13:13:13 +02:00
|
|
|
## This file is part of Gajim.
|
|
|
|
##
|
|
|
|
## Gajim is free software; you can redistribute it and/or modify
|
2005-12-01 18:16:53 +01:00
|
|
|
## it under the terms of the GNU General Public License as published
|
2007-10-22 13:13:13 +02:00
|
|
|
## by the Free Software Foundation; version 3 only.
|
2005-12-01 18:16:53 +01:00
|
|
|
##
|
2007-10-22 13:13:13 +02:00
|
|
|
## Gajim is distributed in the hope that it will be useful,
|
2005-12-01 18:16:53 +01:00
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-08-15 05:20:23 +02:00
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2005-12-01 18:16:53 +01:00
|
|
|
## GNU General Public License for more details.
|
|
|
|
##
|
2007-10-22 13:13:13 +02:00
|
|
|
## You should have received a copy of the GNU General Public License
|
2008-08-15 05:20:23 +02:00
|
|
|
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
2007-10-22 13:13:13 +02:00
|
|
|
##
|
2005-12-01 18:16:53 +01:00
|
|
|
|
|
|
|
class PysqliteNotAvailable(Exception):
|
|
|
|
'''sqlite2 is not installed or python bindings are missing'''
|
|
|
|
def __init__(self):
|
|
|
|
Exception.__init__(self)
|
|
|
|
|
|
|
|
def __str__(self):
|
2005-12-27 22:03:02 +01:00
|
|
|
return _('pysqlite2 (aka python-pysqlite2) dependency is missing. Exiting...')
|
2005-12-01 18:16:53 +01:00
|
|
|
|
2007-07-09 18:01:19 +02:00
|
|
|
class PysqliteOperationalError(Exception):
|
|
|
|
'''sqlite2 raised pysqlite2.dbapi2.OperationalError'''
|
|
|
|
def __init__(self, text=''):
|
|
|
|
Exception.__init__(self)
|
|
|
|
self.text = text
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.text
|
|
|
|
|
2008-03-17 08:22:43 +01:00
|
|
|
class DatabaseMalformed(Exception):
|
|
|
|
'''The databas can't be read'''
|
|
|
|
def __init__(self):
|
|
|
|
Exception.__init__(self)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return _('Database cannot be read.')
|
|
|
|
|
2005-12-01 18:16:53 +01:00
|
|
|
class ServiceNotAvailable(Exception):
|
|
|
|
'''This exception is raised when we cannot use Gajim remotely'''
|
|
|
|
def __init__(self):
|
|
|
|
Exception.__init__(self)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return _('Service not available: Gajim is not running, or remote_control is False')
|
|
|
|
|
|
|
|
class DbusNotSupported(Exception):
|
|
|
|
'''D-Bus is not installed or python bindings are missing'''
|
|
|
|
def __init__(self):
|
|
|
|
Exception.__init__(self)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return _('D-Bus is not present on this machine or python module is missing')
|
|
|
|
|
|
|
|
class SessionBusNotPresent(Exception):
|
|
|
|
'''This exception indicates that there is no session daemon'''
|
|
|
|
def __init__(self):
|
|
|
|
Exception.__init__(self)
|
|
|
|
|
|
|
|
def __str__(self):
|
2006-03-19 22:21:16 +01:00
|
|
|
return _('Session bus is not available.\nTry reading http://trac.gajim.org/wiki/GajimDBus')
|
2006-10-07 14:41:19 +02:00
|
|
|
|
2007-07-12 08:25:05 +02:00
|
|
|
class NegotiationError(Exception):
|
|
|
|
'''A session negotiation failed'''
|
|
|
|
pass
|
|
|
|
|
|
|
|
class DecryptionError(Exception):
|
|
|
|
'''A message couldn't be decrypted into usable XML'''
|
|
|
|
pass
|
|
|
|
|
2007-09-29 22:51:01 +02:00
|
|
|
class Cancelled(Exception):
|
|
|
|
'''The user cancelled an operation'''
|
|
|
|
pass
|
|
|
|
|
2006-10-07 14:41:19 +02:00
|
|
|
class GajimGeneralException(Exception):
|
2007-07-12 08:25:05 +02:00
|
|
|
'''This exception is our general exception'''
|
2006-10-07 14:41:19 +02:00
|
|
|
def __init__(self, text=''):
|
|
|
|
Exception.__init__(self)
|
2006-10-08 04:33:34 +02:00
|
|
|
self.text = text
|
2006-10-07 14:41:19 +02:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.text
|
2008-07-29 21:49:31 +02:00
|
|
|
|
2008-08-15 05:20:23 +02:00
|
|
|
# vim: se ts=3:
|