1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 r"""errors.py: Exceptions for the search engine core.
19
20 """
21 __docformat__ = "restructuredtext en"
22
24 r"""Base class for exceptions thrown by the search engine.
25
26 Any errors generated by xappy itself, or by xapian, will be instances of
27 this class or its subclasses.
28
29 """
30
32 r"""Class used to report errors relating to the indexing API.
33
34 """
35
37 r"""Class used to report errors relating to the search API.
38
39 """
40
41
43 r"""Base class for exceptions thrown by the xapian.
44
45 Any errors generated by xapian will be instances of this class or its
46 subclasses.
47
48 """
49
51 """Add new base classes for all the xapian exceptions.
52
53 """
54 import xapian
55 for name in (
56 'AssertionError',
57 'DatabaseCorruptError',
58 'DatabaseCreateError',
59 'DatabaseError',
60 'DatabaseLockError',
61 'DatabaseModifiedError',
62 'DatabaseOpeningError',
63 'DatabaseVersionError',
64 'DocNotFoundError',
65
66
67
68
69
70 'FeatureUnavailableError',
71 'InternalError',
72 'InvalidArgumentError',
73 'InvalidOperationError',
74 'LogicError',
75 'NetworkError',
76 'NetworkTimeoutError',
77 'QueryParserError',
78 'RangeError',
79 'RuntimeError',
80 'UnimplementedError',
81 ):
82 xapian_exception = getattr(xapian, name, None)
83 if xapian_exception is not None:
84 xapian_exception.__bases__ += (XapianError, )
85 globals()['Xapian' + name] = xapian_exception
86
87 _rebase_xapian_exceptions()
88