]> git.evergreen-ils.org Git - OpenSRF.git/blob - src/python/osrf/ex.py
4c160f3b91d154afe4b20ea4fdf160b85b57b716
[OpenSRF.git] / src / python / osrf / ex.py
1 # -----------------------------------------------------------------------
2 # Copyright (C) 2007  Georgia Public Library Service
3 # Bill Erickson <billserickson@gmail.com>
4
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 #
16 # This modules define the exception classes.  In general, an 
17 # exception is little more than a name.
18 # -----------------------------------------------------------------------
19
20 class osrfException(Exception):
21         """Root class for exceptions."""
22         def __init__(self, info=None):
23                 self.info = info;
24         def __str__(self):
25                 return self.info
26
27
28 class osrfNetworkException(osrfException):
29         def __str__(self):
30                 str = "\nUnable to communicate with the OpenSRF network"
31                 if self.info:
32                         str = str + '\n' + repr(self.info)
33                 return str
34
35 class osrfProtocolException(osrfException):
36         """Raised when something happens during opensrf network stack processing."""
37         pass
38
39 class osrfServiceException(osrfException):
40         """Raised when there was an error communicating with a remote service."""
41         pass
42
43 class osrfConfigException(osrfException):
44         """Invalid config option requested."""
45         pass
46
47 class osrfNetworkObjectException(osrfException):
48         pass
49         
50 class osrfJSONParseException(osrfException):
51         """Raised when a JSON parsing error occurs."""
52         pass
53
54
55