Automatic Differentiation
 
Loading...
Searching...
No Matches
system_error.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_SYSTEM_ERROR_HPP
2#define STAN_MATH_PRIM_ERR_SYSTEM_ERROR_HPP
3
5#include <typeinfo>
6#include <sstream>
7#include <stdexcept>
8#include <system_error>
9namespace stan {
10namespace math {
11
25inline 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
45inline 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.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...