root/MGET/Trunk/PythonPackage/src/GeoEco/Exceptions.py

Revision 42, 1.5 kB (checked in by jjr8, 3 years ago)

Inserted copyright statements in all source code that place GeoEco? under the GNU General Public License. (Resolved ticket #3).

Line 
1 # Exceptions.py - Defines the base class for custom exceptions defined by
2 # modules of the GeoEco Python package.
3 #
4 # Copyright (C) 2007 Jason J. Roberts
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License (available in the file LICENSE.TXT)
15 # for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
21 import codecs
22 import types
23
24
25 class GeoEcoError(Exception):
26
27     def __init__(self, message):
28         assert isinstance(message, types.UnicodeType), u'message must be a unicode string.'
29         self.Message = message
30
31     def __str__(self):
32         return codecs.encode(self.Message, u'ascii', u'replace')
33
34     def __unicode__(self):
35         return self.Message
36
37
38 ###############################################################################
39 # Names exported by this module
40 ###############################################################################
41
42 __all__ = ['GeoEcoError']
Note: See TracBrowser for help on using the browser.