Add timestamp offset for block header
[p2pool.git] / SOAPpy / Errors.py
1 """
2 ################################################################################
3 #
4 # SOAPpy - Cayce Ullman       (cayce@actzero.com)
5 #          Brian Matthews     (blm@actzero.com)
6 #          Gregory Warnes     (Gregory.R.Warnes@Pfizer.com)
7 #          Christopher Blunck (blunck@gst.com)
8 #
9 ################################################################################
10 # Copyright (c) 2003, Pfizer
11 # Copyright (c) 2001, Cayce Ullman.
12 # Copyright (c) 2001, Brian Matthews.
13 #
14 # All rights reserved.
15 #
16 # Redistribution and use in source and binary forms, with or without
17 # modification, are permitted provided that the following conditions are met:
18 # Redistributions of source code must retain the above copyright notice, this
19 # list of conditions and the following disclaimer.
20 #
21 # Redistributions in binary form must reproduce the above copyright notice,
22 # this list of conditions and the following disclaimer in the documentation
23 # and/or other materials provided with the distribution.
24 #
25 # Neither the name of actzero, inc. nor the names of its contributors may
26 # be used to endorse or promote products derived from this software without
27 # specific prior written permission.
28 #
29 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
30 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
33 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #
40 ################################################################################
41 """
42
43 ident = '$Id: Errors.py 921 2005-02-15 16:32:23Z warnes $'
44 from version import __version__
45
46 import exceptions
47
48 ################################################################################
49 # Exceptions
50 ################################################################################
51 class Error(exceptions.Exception):
52     def __init__(self, msg):
53         self.msg = msg
54     def __str__(self):
55         return "<Error : %s>" % self.msg
56     __repr__ = __str__
57     def __call__(self):
58         return (msg,)
59
60 class RecursionError(Error):
61     pass
62
63 class UnknownTypeError(Error):
64     pass
65
66 class HTTPError(Error):
67     # indicates an HTTP protocol error
68     def __init__(self, code, msg):
69         self.code = code
70         self.msg  = msg
71     def __str__(self):
72         return "<HTTPError %s %s>" % (self.code, self.msg)
73     __repr__ = __str__
74     def __call___(self):
75         return (self.code, self.msg, )
76
77 class UnderflowError(exceptions.ArithmeticError):
78     pass
79