LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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::detail {
9  template <typename L>
10  void
11  try_insert(L l, std::string const& key)
12  try {
13  l(key);
14  }
15  catch (boost::bad_lexical_cast const& e) {
16  throw fhicl::exception{cant_insert, key} << e.what();
17  }
18  catch (boost::bad_numeric_cast const& e) {
19  throw fhicl::exception{cant_insert, key} << e.what();
20  }
21  catch (fhicl::exception const& e) {
22  throw fhicl::exception{cant_insert, key, e};
23  }
24  catch (std::exception const& e) {
25  throw fhicl::exception{cant_insert, key} << e.what();
26  }
27 }
28 
29 #endif /* fhiclcpp_detail_try_blocks_h */
30 
31 // Local variables:
32 // mode: c++
33 // End:
void try_insert(L l, std::string const &key)
Definition: try_blocks.h:11
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33