2008-08-15 19:31:51 +02:00
|
|
|
# -*- coding:utf-8 -*-
|
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>
|
2014-01-02 09:33:54 +01:00
|
|
|
## Copyright (C) 2005-2014 Yann Leboulanger <asterix AT lagaule.org>
|
2008-08-15 05:20:23 +02:00
|
|
|
## Copyright (C) 2006 Jean-Marie Traissard <jim AT lapin.org>
|
|
|
|
## Copyright (C) 2007 Brendan Taylor <whateley AT gmail.com>
|
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
|
|
|
|
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') % \
|
|
|
|
{'url': 'http://trac.gajim.org/wiki/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') % \
|
|
|
|
{'url': '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):
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
A session negotiation failed
|
|
|
|
"""
|
|
|
|
pass
|
2007-07-12 08:25:05 +02:00
|
|
|
|
|
|
|
class DecryptionError(Exception):
|
2010-02-08 15:08:40 +01:00
|
|
|
"""
|
|
|
|
A message couldn't be decrypted into usable XML
|
|
|
|
"""
|
|
|
|
pass
|
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
|
|
|
|
"""
|
|
|
|
pass
|
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
|