try_blocks.h
Go to the documentation of this file.
1 #ifndef fhiclcpp_detail_try_blocks_h
2 #define fhiclcpp_detail_try_blocks_h
3 
4 #include "fhiclcpp/exception.h"
5 
6 #include <string>
7 
8 namespace fhicl {
9  namespace detail {
10 
11  template <typename L>
12  void
13  try_insert(L l, std::string const& key) try {
14  l(key);
15  }
16  catch (boost::bad_lexical_cast const& e) {
17  throw fhicl::exception(cant_insert, key) << e.what();
18  }
19  catch (boost::bad_numeric_cast const& e) {
20  throw fhicl::exception(cant_insert, key) << e.what();
21  }
22  catch (fhicl::exception const& e) {
23  throw fhicl::exception(cant_insert, key, e);
24  }
25  catch (std::exception const& e) {
26  throw fhicl::exception(cant_insert, key) << e.what();
27  }
28  }
29 }
30 
31 #endif /* fhiclcpp_detail_try_blocks_h */
32 
33 // Local variables:
34 // mode: c++
35 // End:
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
void try_insert(L l, std::string const &key)
Definition: try_blocks.h:13
static constexpr double L
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
enum BeamMode string