Bayeux
3.4.1
Core Foundation library for SuperNEMO
bayeux
datatools
exception.h
Go to the documentation of this file.
1
//
12
// Copyright (c) 2013 by Ben Morgan <bmorgan.warwick@gmail.com>
13
// Copyright (c) 2013 by The University of Warwick
14
//
15
// This file is part of datatools.
16
//
17
// datatools is free software: you can redistribute it and/or modify
18
// it under the terms of the GNU General Public License as published by
19
// the Free Software Foundation, either version 3 of the License, or
20
// (at your option) any later version.
21
//
22
// datatools is distributed in the hope that it will be useful,
23
// but WITHOUT ANY WARRANTY; without even the implied warranty of
24
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
// GNU General Public License for more details.
26
//
27
// You should have received a copy of the GNU General Public License
28
// along with datatools. If not, see <http://www.gnu.org/licenses/>.
29
30
#ifndef DATATOOLS_EXCEPTION_H
31
#define DATATOOLS_EXCEPTION_H
32
// Standard Library:
33
#include <stdexcept>
34
#include <sstream>
35
36
// Third Party:
37
// - Boost:
38
#include <boost/current_function.hpp>
39
76
#define DT_THROW_IF(Condition, ExceptionType, Message) \
77
{ \
78
if (Condition) { \
79
std::stringstream sDT_THROW_IF_ONLY; \
80
sDT_THROW_IF_ONLY << "[" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << ": " << Message << "]"; \
81
throw ExceptionType(sDT_THROW_IF_ONLY.str()); \
82
} \
83
}
84
85
121
#define DT_THROW(ExceptionType, Message) \
122
{ \
123
std::stringstream sDT_THROW_ONLY; \
124
sDT_THROW_ONLY << "[" << BOOST_CURRENT_FUNCTION << ":" << __LINE__ << ": " << Message << "]"; \
125
throw ExceptionType(sDT_THROW_ONLY.str()); \
126
}
127
128
#endif // DATATOOLS_EXCEPTION_H
129
130
// Local Variables: --
131
// mode: c++ --
132
// c-file-style: "gnu" --
133
// tab-width: 2 --
134
// End: --
Generated by
1.8.15