source: rrlib_xml/tException.h

tip
Last change on this file was 57:3d0021116fb4, checked in by Tobias Föhst <foehst@…>, 9 years ago

Added and updated license information

File size: 3.6 KB
Line 
1//
2// You received this file as part of RRLib
3// Robotics Research Library
4//
5// Copyright (C) Finroc GbR (finroc.org)
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License along
18// with this program; if not, write to the Free Software Foundation, Inc.,
19// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20//
21//----------------------------------------------------------------------
22/*!\file    rrlib/xml/tException.h
23 *
24 * \author  Tobias Foehst
25 *
26 * \date    2010-06-26
27 *
28 * \brief   Contains tException
29 *
30 * \b tException
31 *
32 * Runtime errors that come along with invalid XML input are handled
33 * by throwing an instance of tException, which is the only
34 * proper way to cope with construction errors.
35 * tException is derived from std::runtime_error and thus
36 * can be caught either especially for this library or in a general
37 * runtime_error block.
38 *
39 */
40//----------------------------------------------------------------------
41#ifndef __rrlib__xml__tException_h__
42#define __rrlib__xml__tException_h__
43
44//----------------------------------------------------------------------
45// External includes (system with <>, local with "")
46//----------------------------------------------------------------------
47#include <stdexcept>
48
49//----------------------------------------------------------------------
50// Internal includes with ""
51//----------------------------------------------------------------------
52
53//----------------------------------------------------------------------
54// Debugging
55//----------------------------------------------------------------------
56
57//----------------------------------------------------------------------
58// Namespace declaration
59//----------------------------------------------------------------------
60namespace rrlib
61{
62namespace xml
63{
64
65//----------------------------------------------------------------------
66// Forward declarations / typedefs / enums
67//----------------------------------------------------------------------
68
69//----------------------------------------------------------------------
70// Class declaration
71//----------------------------------------------------------------------
72//! Exceptions thrown in RRLib XML2 Wrapper are of this type.
73/*! This exception class is a std::runtime_error and used when invalid
74 *  XML input is encountered that can not be handled automatically.
75 *  Thus, catching exceptions of this type distinguishes from other runtime
76 *  errors.
77 *
78 */
79class tException : public std::runtime_error
80{
81
82//----------------------------------------------------------------------
83// Public methods
84//----------------------------------------------------------------------
85public:
86
87  /*! The ctor of tException
88   *
89   * This ctor forwards instantiation of an exception object to
90   * std::runtime_error with the given message as error description.
91   *
92   * \param message   A message that describes the error
93   */
94  tException(const std::string &message)
95    : std::runtime_error(message)
96  {}
97
98};
99
100//----------------------------------------------------------------------
101// End of namespace declaration
102//----------------------------------------------------------------------
103}
104}
105
106#endif
Note: See TracBrowser for help on using the repository browser.