2018-09-05 02:59:34 +02:00
|
|
|
# Copyright (C) 2005-2006 Nikos Kouremenos <kourem AT gmail.com>
|
|
|
|
# Copyright (C) 2005-2014 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>
|
|
|
|
#
|
|
|
|
# This file is part of Gajim.
|
|
|
|
#
|
|
|
|
# Gajim is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published
|
|
|
|
# by the Free Software Foundation; version 3 only.
|
|
|
|
#
|
|
|
|
# Gajim is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2018-10-04 23:55:35 +02:00
|
|
|
from gajim.common.i18n import _
|
|
|
|
|
2005-12-01 18:16:53 +01:00
|
|
|
|
2007-07-09 18:01:19 +02:00
|
|
|
class PysqliteOperationalError(Exception):
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
Sqlite2 raised pysqlite2.dbapi2.OperationalError
|
|
|
|
"""
|
2009-11-26 12:58:12 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __init__(self, text=''):
|
|
|
|
Exception.__init__(self)
|
|
|
|
self.text = text
|
2007-07-09 18:01:19 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __str__(self):
|
|
|
|
return self.text
|
2007-07-09 18:01:19 +02:00
|
|
|
|
2008-03-17 08:22:43 +01:00
|
|
|
class DatabaseMalformed(Exception):
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
The databas can't be read
|
|
|
|
"""
|
2009-11-26 12:58:12 +01:00
|
|
|
|
2017-04-08 22:53:50 +02:00
|
|
|
def __init__(self, path=''):
|
2010-02-08 15:08:40 +01:00
|
|
|
Exception.__init__(self)
|
2017-04-08 22:53:50 +02:00
|
|
|
self.path = path
|
2008-03-17 08:22:43 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __str__(self):
|
2017-04-08 22:53:50 +02:00
|
|
|
return _('The database file (%s) cannot be read. '
|
|
|
|
'Try to repair it (see '
|
|
|
|
'https://dev.gajim.org/gajim/gajim/wikis/help/DatabaseBackup)'
|
|
|
|
' or remove it (all history will be lost).') % self.path
|
2008-03-17 08:22:43 +01:00
|
|
|
|
2005-12-01 18:16:53 +01:00
|
|
|
class ServiceNotAvailable(Exception):
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
This exception is raised when we cannot use Gajim remotely'
|
|
|
|
"""
|
2009-11-26 12:58:12 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __init__(self):
|
|
|
|
Exception.__init__(self)
|
2005-12-01 18:16:53 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __str__(self):
|
|
|
|
return _('Service not available: Gajim is not running, or remote_control is False')
|
2005-12-01 18:16:53 +01:00
|
|
|
|
|
|
|
class DbusNotSupported(Exception):
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
D-Bus is not installed or python bindings are missing
|
|
|
|
"""
|
2009-11-26 12:58:12 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __init__(self):
|
|
|
|
Exception.__init__(self)
|
2005-12-01 18:16:53 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __str__(self):
|
|
|
|
return _('D-Bus is not present on this machine or python module is missing')
|
2005-12-01 18:16:53 +01:00
|
|
|
|
|
|
|
class SessionBusNotPresent(Exception):
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
This exception indicates that there is no session daemon
|
|
|
|
"""
|
2009-11-26 12:58:12 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __init__(self):
|
|
|
|
Exception.__init__(self)
|
2005-12-01 18:16:53 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __str__(self):
|
|
|
|
return _('Session bus is not available.\nTry reading %(url)s') % \
|
2017-08-27 22:32:33 +02:00
|
|
|
{'url': 'https://dev.gajim.org/gajim/gajim/wikis/help/GajimDBus'}
|
2009-12-01 17:41:43 +01:00
|
|
|
|
|
|
|
class SystemBusNotPresent(Exception):
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
This exception indicates that there is no session daemon
|
|
|
|
"""
|
2009-12-01 17:41:43 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __init__(self):
|
|
|
|
Exception.__init__(self)
|
2009-12-01 17:41:43 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __str__(self):
|
|
|
|
return _('System bus is not available.\nTry reading %(url)s') % \
|
2017-08-27 22:32:33 +02:00
|
|
|
{'url': 'https://dev.gajim.org/gajim/gajim/wikis/help/GajimDBus'}
|
2006-10-07 14:41:19 +02:00
|
|
|
|
2007-07-12 08:25:05 +02:00
|
|
|
class NegotiationError(Exception):
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
A session negotiation failed
|
|
|
|
"""
|
2007-07-12 08:25:05 +02:00
|
|
|
|
2007-09-29 22:51:01 +02:00
|
|
|
class Cancelled(Exception):
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
The user cancelled an operation
|
|
|
|
"""
|
2007-09-29 22:51:01 +02:00
|
|
|
|
2008-11-03 11:33:14 +01:00
|
|
|
class LatexError(Exception):
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
LaTeX processing failed for some reason
|
|
|
|
"""
|
2009-11-26 12:58:12 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __init__(self, text=''):
|
|
|
|
Exception.__init__(self)
|
|
|
|
self.text = text
|
2008-11-03 11:33:14 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __str__(self):
|
|
|
|
return self.text
|
2008-11-03 11:33:14 +01:00
|
|
|
|
2006-10-07 14:41:19 +02:00
|
|
|
class GajimGeneralException(Exception):
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
This exception is our general exception
|
|
|
|
"""
|
2009-11-26 12:58:12 +01:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __init__(self, text=''):
|
|
|
|
Exception.__init__(self)
|
|
|
|
self.text = text
|
2006-10-07 14:41:19 +02:00
|
|
|
|
2010-02-08 15:08:40 +01:00
|
|
|
def __str__(self):
|
|
|
|
return self.text
|
2010-09-14 19:31:35 +02:00
|
|
|
|
|
|
|
class PluginsystemError(Exception):
|
|
|
|
"""
|
|
|
|
Error in the pluginsystem
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self, text=''):
|
|
|
|
Exception.__init__(self)
|
|
|
|
self.text = text
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.text
|
2018-02-08 21:05:15 +01:00
|
|
|
|
|
|
|
class StanzaMalformed(Exception):
|
|
|
|
"""
|
|
|
|
Malfromed Stanza
|
|
|
|
"""
|
|
|
|
def __init__(self, message, stanza=''):
|
|
|
|
Exception.__init__(self, message, stanza)
|
|
|
|
self._msg = '{}\n{}'.format(message, stanza)
|
|
|
|
def __str__(self):
|
|
|
|
return self._msg
|