Stan Math Library  2.20.0
reverse mode automatic differentiation
system_error.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_ERR_SYSTEM_ERROR_HPP
2 #define STAN_MATH_PRIM_SCAL_ERR_SYSTEM_ERROR_HPP
3 
5 #include <typeinfo>
6 #include <sstream>
7 #include <stdexcept>
8 #include <system_error>
9 namespace stan {
10 namespace math {
11 
25 inline void system_error(const char* function, const char* name, const int& y,
26  const char* msg1, const char* msg2) {
27  std::ostringstream message;
28  // hack to remove -Waddress, -Wnonnull-compare warnings from GCC 6
29  message << function << ": " << name << " " << msg1 << msg2;
30  throw std::system_error(y, std::generic_category(), message.str());
31 }
32 
45 inline void system_error(const char* function, const char* name, const int& y,
46  const char* msg1) {
47  system_error(function, name, y, msg1, "");
48 }
49 
50 } // namespace math
51 } // namespace stan
52 #endif
void system_error(const char *function, const char *name, const int &y, const char *msg1, const char *msg2)
Throw a system error with a consistently formatted message.
void system_error(const char *function, const char *name, const int &y, const char *msg1)
Throw a system error with a consistently formatted message.

     [ Stan Home Page ] © 2011–2018, Stan Development Team.