error_handling_example.qbk 1.3 KB

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