Lucene++ - a full-featured, c++ search engine
API Documentation

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

LuceneException.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6
7 #ifndef LUCENEEXCEPTION_H
8 #define LUCENEEXCEPTION_H
9
10 #include "Lucene.h"
11
12 namespace Lucene {
13
15 class LPPAPI LuceneException : public std::exception {
16 public:
17 enum ExceptionType {
18 Null,
19 AlreadyClosed,
20 Compression,
21 CorruptIndex,
22 FieldReader,
23 FileNotFound,
24 IllegalArgument,
25 IllegalState,
26 IndexOutOfBounds,
27 IO,
28 LockObtainFailed,
29 LockReleaseFailed,
30 Lookahead,
31 MergeAborted,
32 Merge,
33 NoSuchDirectory,
34 NullPointer,
35 NumberFormat,
36 OutOfMemory,
37 Parse,
38 QueryParser,
39 Runtime,
40 StaleReader,
41 StopFillCache,
42 Temporary,
43 TimeExceeded,
44 TooManyClauses,
45 UnsupportedOperation
46 };
47
48 LuceneException(const String& error = EmptyString, LuceneException::ExceptionType type = Null) throw();
49 ~LuceneException() throw();
50
51 protected:
52 ExceptionType type;
53 String error;
54
55 public:
56 ExceptionType getType() const;
57 String getError() const;
58 bool isNull() const;
59 void throwException();
60 };
61
62 template <class ParentException, LuceneException::ExceptionType Type>
63 class ExceptionTemplate : public ParentException {
64 public:
65 ExceptionTemplate(const String& error = EmptyString, LuceneException::ExceptionType type = Type) : ParentException(error, type) {
66 }
67 };
68
69 typedef ExceptionTemplate<LuceneException, LuceneException::Runtime> RuntimeException;
70 typedef ExceptionTemplate<LuceneException, LuceneException::OutOfMemory> OutOfMemoryError;
71 typedef ExceptionTemplate<LuceneException, LuceneException::Temporary> TemporaryException;
72 typedef ExceptionTemplate<RuntimeException, LuceneException::IllegalState> IllegalStateException;
73 typedef ExceptionTemplate<RuntimeException, LuceneException::IllegalArgument> IllegalArgumentException;
74 typedef ExceptionTemplate<RuntimeException, LuceneException::IndexOutOfBounds> IndexOutOfBoundsException;
75 typedef ExceptionTemplate<RuntimeException, LuceneException::NullPointer> NullPointerException;
76 typedef ExceptionTemplate<RuntimeException, LuceneException::FieldReader> FieldReaderException;
77 typedef ExceptionTemplate<RuntimeException, LuceneException::Merge> MergeException;
78 typedef ExceptionTemplate<RuntimeException, LuceneException::StopFillCache> StopFillCacheException;
79 typedef ExceptionTemplate<RuntimeException, LuceneException::TimeExceeded> TimeExceededException;
80 typedef ExceptionTemplate<RuntimeException, LuceneException::TooManyClauses> TooManyClausesException;
81 typedef ExceptionTemplate<RuntimeException, LuceneException::UnsupportedOperation> UnsupportedOperationException;
82 typedef ExceptionTemplate<IllegalArgumentException, LuceneException::NumberFormat> NumberFormatException;
83 typedef ExceptionTemplate<IllegalStateException, LuceneException::AlreadyClosed> AlreadyClosedException;
84 typedef ExceptionTemplate<LuceneException, LuceneException::IO> IOException;
85 typedef ExceptionTemplate<IOException, LuceneException::CorruptIndex> CorruptIndexException;
86 typedef ExceptionTemplate<IOException, LuceneException::FileNotFound> FileNotFoundException;
87 typedef ExceptionTemplate<IOException, LuceneException::LockObtainFailed> LockObtainFailedException;
88 typedef ExceptionTemplate<IOException, LuceneException::LockReleaseFailed> LockReleaseFailedException;
89 typedef ExceptionTemplate<IOException, LuceneException::MergeAborted> MergeAbortedException;
90 typedef ExceptionTemplate<IOException, LuceneException::StaleReader> StaleReaderException;
91 typedef ExceptionTemplate<FileNotFoundException, LuceneException::NoSuchDirectory> NoSuchDirectoryException;
92 typedef ExceptionTemplate<LuceneException, LuceneException::Lookahead> LookaheadSuccess;
93 typedef ExceptionTemplate<LuceneException, LuceneException::Parse> ParseException;
94 typedef ExceptionTemplate<LuceneException, LuceneException::QueryParser> QueryParserError;
95 typedef ExceptionTemplate<LuceneException, LuceneException::Compression> CompressionException;
96 }
97
98 #endif
Lucene::LuceneException::Null
Definition: LuceneException.h:18
Lucene::LuceneException::Temporary
Definition: LuceneException.h:42
Lucene::LockReleaseFailedException
ExceptionTemplate< IOException, LuceneException::LockReleaseFailed > LockReleaseFailedException
Definition: LuceneException.h:88
Lucene::LuceneException::IllegalState
Definition: LuceneException.h:25
Lucene::FieldReaderException
ExceptionTemplate< RuntimeException, LuceneException::FieldReader > FieldReaderException
Definition: LuceneException.h:76
Lucene::LuceneException::CorruptIndex
Definition: LuceneException.h:21
Lucene::LuceneException::NoSuchDirectory
Definition: LuceneException.h:33
Lucene::LuceneException::FieldReader
Definition: LuceneException.h:22
Lucene::LuceneException::IO
Definition: LuceneException.h:27
Lucene::AlreadyClosedException
ExceptionTemplate< IllegalStateException, LuceneException::AlreadyClosed > AlreadyClosedException
Definition: LuceneException.h:83
Lucene::MergeAbortedException
ExceptionTemplate< IOException, LuceneException::MergeAborted > MergeAbortedException
Definition: LuceneException.h:89
Lucene::TimeExceededException
ExceptionTemplate< RuntimeException, LuceneException::TimeExceeded > TimeExceededException
Definition: LuceneException.h:79
Lucene::LuceneException::Runtime
Definition: LuceneException.h:39
Lucene::LuceneException::ExceptionType
ExceptionType
Definition: LuceneException.h:17
Lucene::LuceneException::MergeAborted
Definition: LuceneException.h:31
Lucene::LuceneException::TimeExceeded
Definition: LuceneException.h:43
Lucene::LuceneException::Merge
Definition: LuceneException.h:32
Lucene::LuceneException::IndexOutOfBounds
Definition: LuceneException.h:26
Lucene::LuceneException::StaleReader
Definition: LuceneException.h:40
Lucene::CorruptIndexException
ExceptionTemplate< IOException, LuceneException::CorruptIndex > CorruptIndexException
Definition: LuceneException.h:85
Lucene::LuceneException::LockObtainFailed
Definition: LuceneException.h:28
Lucene::LuceneException::Parse
Definition: LuceneException.h:37
Lucene::ExceptionTemplate
Definition: LuceneException.h:63
Lucene::LuceneException::AlreadyClosed
Definition: LuceneException.h:19
Lucene::LuceneException::IllegalArgument
Definition: LuceneException.h:24
Lucene::StopFillCacheException
ExceptionTemplate< RuntimeException, LuceneException::StopFillCache > StopFillCacheException
Definition: LuceneException.h:78
Lucene::NullPointerException
ExceptionTemplate< RuntimeException, LuceneException::NullPointer > NullPointerException
Definition: LuceneException.h:75
Lucene::IllegalArgumentException
ExceptionTemplate< RuntimeException, LuceneException::IllegalArgument > IllegalArgumentException
Definition: LuceneException.h:73
Lucene::UnsupportedOperationException
ExceptionTemplate< RuntimeException, LuceneException::UnsupportedOperation > UnsupportedOperationException
Definition: LuceneException.h:81
Lucene::StaleReaderException
ExceptionTemplate< IOException, LuceneException::StaleReader > StaleReaderException
Definition: LuceneException.h:90
Lucene::IOException
ExceptionTemplate< LuceneException, LuceneException::IO > IOException
Definition: LuceneException.h:84
Lucene::LookaheadSuccess
ExceptionTemplate< LuceneException, LuceneException::Lookahead > LookaheadSuccess
Definition: LuceneException.h:92
Lucene::TooManyClausesException
ExceptionTemplate< RuntimeException, LuceneException::TooManyClauses > TooManyClausesException
Definition: LuceneException.h:80
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::LuceneException
Lucene exception container.
Definition: LuceneException.h:15
Lucene::LuceneException::OutOfMemory
Definition: LuceneException.h:36
Lucene::FileNotFoundException
ExceptionTemplate< IOException, LuceneException::FileNotFound > FileNotFoundException
Definition: LuceneException.h:86
Lucene::LuceneException::Lookahead
Definition: LuceneException.h:30
Lucene::IndexOutOfBoundsException
ExceptionTemplate< RuntimeException, LuceneException::IndexOutOfBounds > IndexOutOfBoundsException
Definition: LuceneException.h:74
Lucene::LuceneException::NullPointer
Definition: LuceneException.h:34
Lucene::LuceneException::QueryParser
Definition: LuceneException.h:38
Lucene::RuntimeException
ExceptionTemplate< LuceneException, LuceneException::Runtime > RuntimeException
Definition: LuceneException.h:69
Lucene::MergeException
ExceptionTemplate< RuntimeException, LuceneException::Merge > MergeException
Definition: LuceneException.h:77
Lucene::NoSuchDirectoryException
ExceptionTemplate< FileNotFoundException, LuceneException::NoSuchDirectory > NoSuchDirectoryException
Definition: LuceneException.h:91
Lucene::LuceneException::FileNotFound
Definition: LuceneException.h:23
Lucene::LuceneException::LockReleaseFailed
Definition: LuceneException.h:29
Lucene::NumberFormatException
ExceptionTemplate< IllegalArgumentException, LuceneException::NumberFormat > NumberFormatException
Definition: LuceneException.h:82
Lucene::OutOfMemoryError
ExceptionTemplate< LuceneException, LuceneException::OutOfMemory > OutOfMemoryError
Definition: LuceneException.h:70
Lucene::ParseException
ExceptionTemplate< LuceneException, LuceneException::Parse > ParseException
Definition: LuceneException.h:93
Lucene::LuceneException::TooManyClauses
Definition: LuceneException.h:44
Lucene::ExceptionTemplate::ExceptionTemplate
ExceptionTemplate(const String &error=EmptyString, LuceneException::ExceptionType type=Type)
Definition: LuceneException.h:65
Lucene::LuceneException::NumberFormat
Definition: LuceneException.h:35
Lucene::CompressionException
ExceptionTemplate< LuceneException, LuceneException::Compression > CompressionException
Definition: LuceneException.h:95
Lucene::TemporaryException
ExceptionTemplate< LuceneException, LuceneException::Temporary > TemporaryException
Definition: LuceneException.h:71
Lucene::LuceneException::Compression
Definition: LuceneException.h:20
Lucene::LockObtainFailedException
ExceptionTemplate< IOException, LuceneException::LockObtainFailed > LockObtainFailedException
Definition: LuceneException.h:87
Lucene::IllegalStateException
ExceptionTemplate< RuntimeException, LuceneException::IllegalState > IllegalStateException
Definition: LuceneException.h:72
Lucene::QueryParserError
ExceptionTemplate< LuceneException, LuceneException::QueryParser > QueryParserError
Definition: LuceneException.h:94
Lucene::LuceneException::StopFillCache
Definition: LuceneException.h:41

clucene.sourceforge.net