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

Loading...
Searching...
No Matches
LuceneException.h
Go to the documentation of this file.
1
2// 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
51protected:
52 ExceptionType type;
53 String error;
54
55 std::string _what;
56
57public:
58 ExceptionType getType() const;
59 String getError() const;
60 bool isNull() const;
61 void throwException();
62
63 virtual const char* what() const throw();
64};
65
66template <class ParentException, LuceneException::ExceptionType Type>
67class LPPAPI ExceptionTemplate : public ParentException {
68 public:
69 ExceptionTemplate(const String& error = EmptyString, LuceneException::ExceptionType type = Type) : ParentException(error, type) {
70 }
71};
72
73 typedef ExceptionTemplate<LuceneException, LuceneException::Runtime> RuntimeException;
74 typedef ExceptionTemplate<LuceneException, LuceneException::OutOfMemory> OutOfMemoryError;
75 typedef ExceptionTemplate<LuceneException, LuceneException::Temporary> TemporaryException;
76 typedef ExceptionTemplate<RuntimeException, LuceneException::IllegalState> IllegalStateException;
77 typedef ExceptionTemplate<RuntimeException, LuceneException::IllegalArgument> IllegalArgumentException;
78 typedef ExceptionTemplate<RuntimeException, LuceneException::IndexOutOfBounds> IndexOutOfBoundsException;
79 typedef ExceptionTemplate<RuntimeException, LuceneException::NullPointer> NullPointerException;
80 typedef ExceptionTemplate<RuntimeException, LuceneException::FieldReader> FieldReaderException;
81 typedef ExceptionTemplate<RuntimeException, LuceneException::Merge> MergeException;
82 typedef ExceptionTemplate<RuntimeException, LuceneException::StopFillCache> StopFillCacheException;
83 typedef ExceptionTemplate<RuntimeException, LuceneException::TimeExceeded> TimeExceededException;
84 typedef ExceptionTemplate<RuntimeException, LuceneException::TooManyClauses> TooManyClausesException;
85 typedef ExceptionTemplate<RuntimeException, LuceneException::UnsupportedOperation> UnsupportedOperationException;
86 typedef ExceptionTemplate<IllegalArgumentException, LuceneException::NumberFormat> NumberFormatException;
87 typedef ExceptionTemplate<IllegalStateException, LuceneException::AlreadyClosed> AlreadyClosedException;
88 typedef ExceptionTemplate<LuceneException, LuceneException::IO> IOException;
89 typedef ExceptionTemplate<IOException, LuceneException::CorruptIndex> CorruptIndexException;
90 typedef ExceptionTemplate<IOException, LuceneException::FileNotFound> FileNotFoundException;
91 typedef ExceptionTemplate<IOException, LuceneException::LockObtainFailed> LockObtainFailedException;
92 typedef ExceptionTemplate<IOException, LuceneException::LockReleaseFailed> LockReleaseFailedException;
93 typedef ExceptionTemplate<IOException, LuceneException::MergeAborted> MergeAbortedException;
94 typedef ExceptionTemplate<IOException, LuceneException::StaleReader> StaleReaderException;
95 typedef ExceptionTemplate<FileNotFoundException, LuceneException::NoSuchDirectory> NoSuchDirectoryException;
96 typedef ExceptionTemplate<LuceneException, LuceneException::Lookahead> LookaheadSuccess;
97 typedef ExceptionTemplate<LuceneException, LuceneException::Parse> ParseException;
98 typedef ExceptionTemplate<LuceneException, LuceneException::QueryParser> QueryParserError;
99 typedef ExceptionTemplate<LuceneException, LuceneException::Compression> CompressionException;
100}
101
102#endif
Lucene::ExceptionTemplate
Definition LuceneException.h:67
Lucene::ExceptionTemplate::ExceptionTemplate
ExceptionTemplate(const String &error=EmptyString, LuceneException::ExceptionType type=Type)
Definition LuceneException.h:69
Lucene::LuceneException::_what
std::string _what
Definition LuceneException.h:55
Lucene::LuceneException::type
ExceptionType type
Definition LuceneException.h:52
Lucene::LuceneException::~LuceneException
~LuceneException()
Lucene::LuceneException::error
String error
Definition LuceneException.h:53
Lucene::LuceneException::what
virtual const char * what() const
Lucene::LuceneException::getType
ExceptionType getType() const
Lucene::LuceneException::isNull
bool isNull() const
Lucene::LuceneException::LuceneException
LuceneException(const String &error=EmptyString, LuceneException::ExceptionType type=Null)
Lucene::LuceneException::getError
String getError() const
Lucene::LuceneException::throwException
void throwException()
Lucene::LuceneException::ExceptionType
ExceptionType
Definition LuceneException.h:17
Lucene::LuceneException::StopFillCache
@ StopFillCache
Definition LuceneException.h:41
Lucene::LuceneException::FileNotFound
@ FileNotFound
Definition LuceneException.h:23
Lucene::LuceneException::IndexOutOfBounds
@ IndexOutOfBounds
Definition LuceneException.h:26
Lucene::LuceneException::NullPointer
@ NullPointer
Definition LuceneException.h:34
Lucene::LuceneException::IllegalArgument
@ IllegalArgument
Definition LuceneException.h:24
Lucene::LuceneException::LockObtainFailed
@ LockObtainFailed
Definition LuceneException.h:28
Lucene::LuceneException::OutOfMemory
@ OutOfMemory
Definition LuceneException.h:36
Lucene::LuceneException::FieldReader
@ FieldReader
Definition LuceneException.h:22
Lucene::LuceneException::Merge
@ Merge
Definition LuceneException.h:32
Lucene::LuceneException::NumberFormat
@ NumberFormat
Definition LuceneException.h:35
Lucene::LuceneException::QueryParser
@ QueryParser
Definition LuceneException.h:38
Lucene::LuceneException::AlreadyClosed
@ AlreadyClosed
Definition LuceneException.h:19
Lucene::LuceneException::StaleReader
@ StaleReader
Definition LuceneException.h:40
Lucene::LuceneException::Compression
@ Compression
Definition LuceneException.h:20
Lucene::LuceneException::IO
@ IO
Definition LuceneException.h:27
Lucene::LuceneException::MergeAborted
@ MergeAborted
Definition LuceneException.h:31
Lucene::LuceneException::Parse
@ Parse
Definition LuceneException.h:37
Lucene::LuceneException::TooManyClauses
@ TooManyClauses
Definition LuceneException.h:44
Lucene::LuceneException::TimeExceeded
@ TimeExceeded
Definition LuceneException.h:43
Lucene::LuceneException::CorruptIndex
@ CorruptIndex
Definition LuceneException.h:21
Lucene::LuceneException::Runtime
@ Runtime
Definition LuceneException.h:39
Lucene::LuceneException::NoSuchDirectory
@ NoSuchDirectory
Definition LuceneException.h:33
Lucene::LuceneException::Temporary
@ Temporary
Definition LuceneException.h:42
Lucene::LuceneException::Null
@ Null
Definition LuceneException.h:18
Lucene::LuceneException::Lookahead
@ Lookahead
Definition LuceneException.h:30
Lucene::LuceneException::IllegalState
@ IllegalState
Definition LuceneException.h:25
Lucene::LuceneException::LockReleaseFailed
@ LockReleaseFailed
Definition LuceneException.h:29
Lucene::LuceneException::UnsupportedOperation
@ UnsupportedOperation
Definition LuceneException.h:45
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::NoSuchDirectoryException
ExceptionTemplate< FileNotFoundException, LuceneException::NoSuchDirectory > NoSuchDirectoryException
Definition LuceneException.h:95
Lucene::StopFillCacheException
ExceptionTemplate< RuntimeException, LuceneException::StopFillCache > StopFillCacheException
Definition LuceneException.h:82
Lucene::MergeException
ExceptionTemplate< RuntimeException, LuceneException::Merge > MergeException
Definition LuceneException.h:81
Lucene::LockReleaseFailedException
ExceptionTemplate< IOException, LuceneException::LockReleaseFailed > LockReleaseFailedException
Definition LuceneException.h:92
Lucene::OutOfMemoryError
ExceptionTemplate< LuceneException, LuceneException::OutOfMemory > OutOfMemoryError
Definition LuceneException.h:74
Lucene::TimeExceededException
ExceptionTemplate< RuntimeException, LuceneException::TimeExceeded > TimeExceededException
Definition LuceneException.h:83
Lucene::TemporaryException
ExceptionTemplate< LuceneException, LuceneException::Temporary > TemporaryException
Definition LuceneException.h:75
Lucene::IllegalStateException
ExceptionTemplate< RuntimeException, LuceneException::IllegalState > IllegalStateException
Definition LuceneException.h:76
Lucene::NumberFormatException
ExceptionTemplate< IllegalArgumentException, LuceneException::NumberFormat > NumberFormatException
Definition LuceneException.h:86
Lucene::MergeAbortedException
ExceptionTemplate< IOException, LuceneException::MergeAborted > MergeAbortedException
Definition LuceneException.h:93
Lucene::CompressionException
ExceptionTemplate< LuceneException, LuceneException::Compression > CompressionException
Definition LuceneException.h:99
Lucene::CorruptIndexException
ExceptionTemplate< IOException, LuceneException::CorruptIndex > CorruptIndexException
Definition LuceneException.h:89
Lucene::TooManyClausesException
ExceptionTemplate< RuntimeException, LuceneException::TooManyClauses > TooManyClausesException
Definition LuceneException.h:84
Lucene::LookaheadSuccess
ExceptionTemplate< LuceneException, LuceneException::Lookahead > LookaheadSuccess
Definition LuceneException.h:96
Lucene::UnsupportedOperationException
ExceptionTemplate< RuntimeException, LuceneException::UnsupportedOperation > UnsupportedOperationException
Definition LuceneException.h:85
Lucene::RuntimeException
ExceptionTemplate< LuceneException, LuceneException::Runtime > RuntimeException
Definition LuceneException.h:73
Lucene::AlreadyClosedException
ExceptionTemplate< IllegalStateException, LuceneException::AlreadyClosed > AlreadyClosedException
Definition LuceneException.h:87
Lucene::FileNotFoundException
ExceptionTemplate< IOException, LuceneException::FileNotFound > FileNotFoundException
Definition LuceneException.h:90
Lucene::NullPointerException
ExceptionTemplate< RuntimeException, LuceneException::NullPointer > NullPointerException
Definition LuceneException.h:79
Lucene::StaleReaderException
ExceptionTemplate< IOException, LuceneException::StaleReader > StaleReaderException
Definition LuceneException.h:94
Lucene::ParseException
ExceptionTemplate< LuceneException, LuceneException::Parse > ParseException
Definition LuceneException.h:97
Lucene::IOException
ExceptionTemplate< LuceneException, LuceneException::IO > IOException
Definition LuceneException.h:88
Lucene::QueryParserError
ExceptionTemplate< LuceneException, LuceneException::QueryParser > QueryParserError
Definition LuceneException.h:98
Lucene::LockObtainFailedException
ExceptionTemplate< IOException, LuceneException::LockObtainFailed > LockObtainFailedException
Definition LuceneException.h:91
Lucene::IllegalArgumentException
ExceptionTemplate< RuntimeException, LuceneException::IllegalArgument > IllegalArgumentException
Definition LuceneException.h:77
Lucene::IndexOutOfBoundsException
ExceptionTemplate< RuntimeException, LuceneException::IndexOutOfBounds > IndexOutOfBoundsException
Definition LuceneException.h:78
Lucene::FieldReaderException
ExceptionTemplate< RuntimeException, LuceneException::FieldReader > FieldReaderException
Definition LuceneException.h:80

clucene.sourceforge.net