Belle II Software  release-05-02-19
FrameworkExceptions.h
1 #pragma once
2 /**************************************************************************
3  * BASF2 (Belle Analysis Framework 2) *
4  * Copyright(C) 2010 - Belle II Collaboration *
5  * *
6  * Author: The Belle II Collaboration *
7  * Contributors: Andreas Moll, Martin Ritter *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #include <boost/format.hpp>
13 
14 namespace Belle2 {
38 #define BELLE2_DEFINE_EXCEPTION(ClassName, Message) \
39  class ClassName : public std::runtime_error { \
40  public: \
41  ClassName(): std::runtime_error(""), m_format(Message) { } \
42  ~ClassName() noexcept {} \
43  virtual const char * what() const noexcept override { \
44  m_finalStr = m_format.str();\
45  return m_finalStr.c_str();\
46  }\
47  template <class T> ClassName& operator<<(const T& param) {\
48  m_format % param;\
49  return *this;\
50  }\
51  private:\
52  boost::format m_format;\
53  mutable std::string m_finalStr;\
54  };
55 
56 }
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19