1 # -----------------------------------------------------------------------
2 # Copyright (C) 2007 Georgia Public Library Service
3 # Bill Erickson <billserickson@gmail.com>
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.
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.
16 # This modules define the exception classes. In general, an
17 # exception is little more than a name.
18 # -----------------------------------------------------------------------
20 class OSRFException(Exception):
21 """Root class for exceptions."""
22 def __init__(self, info=None):
28 class NetworkException(OSRFException):
30 msg = "\nUnable to communicate with the OpenSRF network"
32 msg = msg + '\n' + unicode(self.info)
35 class OSRFProtocolException(OSRFException):
36 """Raised when something happens during opensrf network stack processing."""
39 class OSRFServiceException(OSRFException):
40 """Raised when there was an error communicating with a remote service."""
43 class OSRFConfigException(OSRFException):
44 """Invalid config option requested."""
47 class OSRFNetworkObjectException(OSRFException):
50 class OSRFJSONParseException(OSRFException):
51 """Raised when a JSON parsing error occurs."""