2003-01-19 06:25:20 +00:00
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2007-06-22 05:57:48 +00:00
|
|
|
# Copyright (C) 2003-2007 Donald N. Allingham
|
2003-01-19 06:25:20 +00:00
|
|
|
#
|
|
|
|
# This program 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; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program 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 this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2005-01-29 05:13:29 +00:00
|
|
|
# $Id$
|
|
|
|
|
2007-05-21 03:44:18 +00:00
|
|
|
"""
|
|
|
|
Provide Error objects
|
|
|
|
"""
|
|
|
|
|
2003-05-23 04:08:03 +00:00
|
|
|
class FilterError(Exception):
|
|
|
|
"""Error used to report Filter errors"""
|
2007-05-21 03:44:18 +00:00
|
|
|
def __init__(self, value, value2=""):
|
2003-05-23 04:08:03 +00:00
|
|
|
Exception.__init__(self)
|
|
|
|
self.value = value
|
|
|
|
self.value2 = value2
|
|
|
|
|
|
|
|
def __str__(self):
|
2007-05-21 03:44:18 +00:00
|
|
|
"Return string representation"
|
2003-05-23 04:08:03 +00:00
|
|
|
return self.value
|
|
|
|
|
|
|
|
def messages(self):
|
2007-05-21 03:44:18 +00:00
|
|
|
"Return the messages"
|
|
|
|
return (self.value, self.value2)
|
2003-05-23 04:08:03 +00:00
|
|
|
|
2006-04-09 22:53:53 +00:00
|
|
|
class DateError(Exception):
|
2005-12-06 06:38:09 +00:00
|
|
|
"""Error used to report Date errors"""
|
2007-05-21 03:44:18 +00:00
|
|
|
def __init__(self, value=""):
|
2005-12-06 06:38:09 +00:00
|
|
|
Exception.__init__(self)
|
|
|
|
self.value = value
|
|
|
|
|
|
|
|
def __str__(self):
|
2007-05-21 03:44:18 +00:00
|
|
|
"Return string representation"
|
2005-12-06 06:38:09 +00:00
|
|
|
return self.value
|
|
|
|
|
2006-04-09 22:53:53 +00:00
|
|
|
class DatabaseError(Exception):
|
|
|
|
"""Error used to report database errors"""
|
2007-05-21 03:44:18 +00:00
|
|
|
def __init__(self, value=""):
|
2006-04-09 22:53:53 +00:00
|
|
|
Exception.__init__(self)
|
|
|
|
self.value = value
|
|
|
|
|
|
|
|
def __str__(self):
|
2007-05-21 03:44:18 +00:00
|
|
|
"Return string representation"
|
2006-04-09 22:53:53 +00:00
|
|
|
return self.value
|
|
|
|
|
2003-01-19 06:25:20 +00:00
|
|
|
class ReportError(Exception):
|
2009-08-14 07:05:59 +00:00
|
|
|
"""Error used to report Report errors."""
|
2007-05-21 03:44:18 +00:00
|
|
|
def __init__(self, value, value2=""):
|
2003-01-29 04:43:12 +00:00
|
|
|
Exception.__init__(self)
|
2003-01-19 06:25:20 +00:00
|
|
|
self.value = value
|
2003-05-16 01:49:50 +00:00
|
|
|
self.value2 = value2
|
2003-01-19 06:25:20 +00:00
|
|
|
|
|
|
|
def __str__(self):
|
2007-05-21 03:44:18 +00:00
|
|
|
"Return string representation"
|
2003-01-19 06:25:20 +00:00
|
|
|
return self.value
|
|
|
|
|
2003-05-16 01:49:50 +00:00
|
|
|
def messages(self):
|
2007-05-21 03:44:18 +00:00
|
|
|
"Return the messages"
|
|
|
|
return (self.value, self.value2)
|
2003-05-16 01:49:50 +00:00
|
|
|
|
2003-01-19 06:25:20 +00:00
|
|
|
class GedcomError(Exception):
|
2003-01-24 03:47:05 +00:00
|
|
|
"""Error used to report GEDCOM errors"""
|
2007-05-21 03:44:18 +00:00
|
|
|
def __init__(self, value):
|
2003-01-29 04:43:12 +00:00
|
|
|
Exception.__init__(self)
|
2003-01-19 06:25:20 +00:00
|
|
|
self.value = value
|
|
|
|
|
|
|
|
def __str__(self):
|
2007-05-21 03:44:18 +00:00
|
|
|
"Return string representation"
|
2003-01-19 06:25:20 +00:00
|
|
|
return self.value
|
|
|
|
|
2011-03-06 18:18:32 +00:00
|
|
|
class GrampsImportError(Exception):
|
|
|
|
"""Error used to report mistakes during import of files into Gramps"""
|
|
|
|
def __init__(self, value, value2=""):
|
|
|
|
Exception.__init__(self)
|
|
|
|
self.value = value
|
|
|
|
self.value2 = value2
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
"Return string representation"
|
|
|
|
return self.value
|
|
|
|
|
|
|
|
def messages(self):
|
|
|
|
"Return the messages"
|
|
|
|
return (self.value, self.value2)
|
|
|
|
|
2003-01-19 06:25:20 +00:00
|
|
|
class PluginError(Exception):
|
2003-01-24 03:47:05 +00:00
|
|
|
"""Error used to report plugin errors"""
|
2007-05-21 03:44:18 +00:00
|
|
|
def __init__(self, value):
|
2003-01-29 04:43:12 +00:00
|
|
|
Exception.__init__(self)
|
2003-01-19 06:25:20 +00:00
|
|
|
self.value = value
|
|
|
|
|
|
|
|
def __str__(self):
|
2007-05-21 03:44:18 +00:00
|
|
|
"Return string representation"
|
2003-01-19 06:25:20 +00:00
|
|
|
return self.value
|
2005-01-29 05:13:29 +00:00
|
|
|
|
|
|
|
class HandleError(Exception):
|
|
|
|
"""Error used to report wrong database handle errors"""
|
2007-05-21 03:44:18 +00:00
|
|
|
def __init__(self, value):
|
2005-01-29 05:13:29 +00:00
|
|
|
Exception.__init__(self)
|
|
|
|
self.value = value
|
|
|
|
|
|
|
|
def __str__(self):
|
2007-05-21 03:44:18 +00:00
|
|
|
"Return string representation"
|
2005-01-29 05:13:29 +00:00
|
|
|
return self.value
|
2005-03-17 20:33:36 +00:00
|
|
|
|
2006-03-01 05:08:11 +00:00
|
|
|
class WindowActiveError(Exception):
|
|
|
|
"""Error used to report that the request window is already displayed."""
|
2007-05-21 03:44:18 +00:00
|
|
|
def __init__(self, value):
|
2006-03-01 05:08:11 +00:00
|
|
|
Exception.__init__(self)
|
|
|
|
self.value = value
|
|
|
|
|
|
|
|
def __str__(self):
|
2007-05-21 03:44:18 +00:00
|
|
|
"Return string representation"
|
2006-03-01 05:08:11 +00:00
|
|
|
return self.value
|
2006-04-21 17:08:34 +00:00
|
|
|
|
|
|
|
class UnavailableError(Exception):
|
2007-05-21 03:44:18 +00:00
|
|
|
def __init__(self, value):
|
2006-04-21 17:08:34 +00:00
|
|
|
Exception.__init__(self)
|
|
|
|
self.value = value
|
|
|
|
|
|
|
|
def __str__(self):
|
2007-05-21 03:44:18 +00:00
|
|
|
"Return string representation"
|
2006-04-21 17:08:34 +00:00
|
|
|
return self.value
|
2007-01-06 22:35:29 +00:00
|
|
|
|
|
|
|
class MaskError(Exception):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class ValidationError(Exception):
|
|
|
|
pass
|
|
|
|
|
2007-06-12 04:29:15 +00:00
|
|
|
class DbError(Exception):
|
2009-08-14 07:05:59 +00:00
|
|
|
"""Error used to report BerkeleyDB errors."""
|
2007-06-12 04:29:15 +00:00
|
|
|
def __init__(self, value):
|
|
|
|
Exception.__init__(self)
|
2008-11-24 09:02:02 +00:00
|
|
|
try:
|
|
|
|
(errnum, errmsg) = value
|
|
|
|
self.value = errmsg
|
|
|
|
except:
|
2007-06-12 04:29:15 +00:00
|
|
|
self.value = value
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
"Return string representation"
|
|
|
|
return self.value
|
2010-07-22 02:16:32 +00:00
|
|
|
|
|
|
|
class MergeError(Exception):
|
|
|
|
"""Error used to report merge errors"""
|
|
|
|
def __init__(self, value=""):
|
|
|
|
Exception.__init__(self)
|
|
|
|
self.value = value
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
"Return string representation"
|
|
|
|
return self.value
|