Belle II Software light-2406-ragdoll
FrameworkExceptions.h
1#pragma once
2/**************************************************************************
3 * basf2 (Belle II Analysis Software Framework) *
4 * Author: The Belle II Collaboration *
5 * *
6 * See git log for contributors and copyright holders. *
7 * This file is licensed under LGPL-3.0, see LICENSE.md. *
8 **************************************************************************/
9
10#include <boost/format.hpp>
11
12namespace Belle2 {
36#define BELLE2_DEFINE_EXCEPTION(ClassName, Message) \
37 class ClassName : public std::runtime_error { \
38 public: \
39 ClassName(): std::runtime_error(""), m_format(Message) { } \
40 ~ClassName() noexcept {} \
41 virtual const char * what() const noexcept override { \
42 m_finalStr = m_format.str();\
43 return m_finalStr.c_str();\
44 }\
45 template <class T> ClassName& operator<<(const T& param) {\
46 m_format % param;\
47 return *this;\
48 }\
49 private:\
50 boost::format m_format;\
51 mutable std::string m_finalStr;\
52 };
54}
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24