mirror of
https://github.com/boostorg/core.git
synced 2025-05-09 23:03:54 +00:00
Document verbose_terminate_handler
This commit is contained in:
parent
622b7a398a
commit
ed84fc4e23
@ -34,7 +34,7 @@ criteria for inclusion is that the utility component be:
|
||||
* simple,
|
||||
* used by other Boost libraries, and
|
||||
* not dependent on any other Boost modules except Core
|
||||
itself, Config, Assert, or Static Assert.
|
||||
itself, Config, Assert, StaticAssert, or ThrowException.
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -72,3 +72,4 @@ criteria for inclusion is that the utility component be:
|
||||
[include type_name.qbk]
|
||||
[include uncaught_exceptions.qbk]
|
||||
[include use_default.qbk]
|
||||
[include verbose_terminate_handler.qbk]
|
||||
|
70
doc/verbose_terminate_handler.qbk
Normal file
70
doc/verbose_terminate_handler.qbk
Normal file
@ -0,0 +1,70 @@
|
||||
[/
|
||||
Copyright 2022 Peter Dimov
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
https://boost.org/LICENSE_1_0.txt
|
||||
]
|
||||
|
||||
[section:verbose_terminate_handler verbose_terminate_handler]
|
||||
|
||||
[simplesect Authors]
|
||||
|
||||
* Peter Dimov
|
||||
|
||||
[endsimplesect]
|
||||
|
||||
[section Header <boost/core/verbose_terminate_handler.hpp>]
|
||||
|
||||
The header `<boost/core/verbose_terminate_handler.hpp>` defines
|
||||
the function `void boost::core::verbose_terminate_handler()`. Its
|
||||
purpose is to be set as a terminate handler as in
|
||||
```
|
||||
std::set_terminate( boost::core::verbose_terminate_handler );
|
||||
```
|
||||
|
||||
When invoked, the function prints information about the current
|
||||
uncaught exception to `stderr` and then calls `std::abort`.
|
||||
|
||||
[section Synopsis]
|
||||
|
||||
``
|
||||
namespace boost
|
||||
{
|
||||
namespace core
|
||||
{
|
||||
|
||||
[[noreturn]] void verbose_terminate_handler();
|
||||
|
||||
} // namespace core
|
||||
} // namespace boost
|
||||
``
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Example]
|
||||
|
||||
```
|
||||
#include <boost/core/verbose_terminate_handler.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <exception>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::set_terminate( boost::core::verbose_terminate_handler );
|
||||
boost::throw_with_location( std::exception() );
|
||||
}
|
||||
```
|
||||
|
||||
Sample output:
|
||||
```
|
||||
std::terminate called after throwing an exception:
|
||||
|
||||
type: class boost::detail::with_throw_location<class std::exception>
|
||||
what(): Unknown exception
|
||||
location: example.cpp:8:12 in function 'main'
|
||||
```
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
@ -60,7 +60,7 @@ BOOST_NORETURN void verbose_terminate_handler()
|
||||
boost::source_location loc = boost::get_throw_location( x );
|
||||
|
||||
std::fprintf( stderr,
|
||||
"std::terminate called after throwing an exception:\n"
|
||||
"std::terminate called after throwing an exception:\n\n"
|
||||
" type: %s\n"
|
||||
" what(): %s\n"
|
||||
" location: %s:%lu:%lu in function '%s'\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user