1[section:error_eg Error Handling Example] 2 3See [link math_toolkit.error_handling error handling documentation] 4for a detailed explanation of the mechanism of handling errors, 5including the common "bad" arguments to distributions and functions, 6and how to use __policy_section to control it. 7 8But, by default, *exceptions will be raised*, for domain errors, 9pole errors, numeric overflow, and internal evaluation errors. 10To avoid the exceptions from getting thrown and instead get 11an appropriate value returned, usually a NaN (domain errors 12pole errors or internal errors), or infinity (from overflow), 13you need to change the policy. 14 15[import ../../example/error_handling_example.cpp] 16 17[error_handling_example] 18 19[caution If throwing of exceptions is enabled (the default) but 20you do *not* have try & catch block, 21then the program will terminate with an uncaught exception and probably abort. 22 23Therefore to get the benefit of helpful error messages, enabling *all exceptions 24and using try & catch* is recommended for most applications. 25 26However, for simplicity, the is not done for most examples.] 27 28[endsect] [/section:error_eg Error Handling Example] 29[/ 30 Copyright 2007 John Maddock and Paul A. Bristow. 31 Distributed under the Boost Software License, Version 1.0. 32 (See accompanying file LICENSE_1_0.txt or copy at 33 http://www.boost.org/LICENSE_1_0.txt). 34] 35 36