OpenStructure
query_error.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_QUERY_ERROR_HH
20 #define OST_QUERY_ERROR_HH
21 
22 #include <ost/range.hh>
23 #include <ost/mol/module_config.hh>
24 
25 namespace ost { namespace mol {
26 
28  QueryErrorDesc(const QueryErrorDesc& _rhs);
29 
30  QueryErrorDesc();
31 
32  QueryErrorDesc& operator=(const QueryErrorDesc& _rhs);
33 
36 };
37 
38 class DLLEXPORT_OST_MOL QueryError : public std::exception {
39 public:
40  QueryError(const String& query, const QueryErrorDesc& desc) throw();
41 
42  ~QueryError() throw();
43 
45  const String& GetMessage()const throw();
46 
47  // Get range of where the error occured
48  const Range& GetRange() const;
49 
51  String GetFormattedMessage() const throw();
53  const String& GetQueryString() const throw();
54 private:
55  String query_;
56  QueryErrorDesc desc_;
57 };
58 
59 }} //ns
60 #endif