1 #ifndef __STAN__MATH__BOOST_ERROR_HANDLING_HPP__
2 #define __STAN__MATH__BOOST_ERROR_HANDLING_HPP__
4 #include <boost/math/policies/policy.hpp>
5 #include <boost/math/policies/error_handling.hpp>
6 #include <boost/math/distributions/detail/common_error_handling.hpp>
12 using boost::math::policies::detail::raise_error;
13 template <
class T_result,
class T_val>
17 const ::boost::math::policies::domain_error< ::boost::math::policies::throw_on_error>&) {
18 raise_error<std::domain_error, T_val>(
function, message, val);
20 return std::numeric_limits<T_result>::quiet_NaN();
23 template <
class T_result,
class T_val>
27 const ::boost::math::policies::domain_error< ::boost::math::policies::ignore_error>&) {
30 return std::numeric_limits<T_result>::quiet_NaN();
33 template <
class T_result,
class T_val>
37 const ::boost::math::policies::domain_error< ::boost::math::policies::errno_on_error>&) {
41 return std::numeric_limits<T_result>::quiet_NaN();
44 template <
class T_result,
class T_val>
48 const ::boost::math::policies::domain_error< ::boost::math::policies::user_error>&) {
49 return user_domain_error(
function, message, val);
54 template <
class T_result,
class T_val,
class Policy>
59 typedef typename Policy::domain_error_type policy_type;
60 return detail::raise_domain_error<T_result,T_val>(
function,
61 message ? message :
"Domain Error evaluating function at %1%",
T_result raise_domain_error(const char *function, const char *message, const T_val &val, const ::boost::math::policies::domain_error< ::boost::math::policies::throw_on_error > &)
T_result raise_domain_error(const char *function, const char *message, const T_val &val, const Policy &)
Probability, optimization and sampling library.