forked from boostorg/exception
minor documentation update
[SVN r47492]
This commit is contained in:
@ -25,10 +25,10 @@
|
||||
<p>The ability to add data to exception objects after they have been passed to throw is important, because often some of the information needed to handle an exception is unavailable in the context where the failure is detected. </p>
|
||||
<p>Boost Exception also supports <span class="RenoLink"><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html">N2179</a></span>-style <span class="RenoLink"><a href="tutorial_exception_ptr.html">copying</a></span> of exception objects, implemented non-intrusively and automatically by the boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span> function.</p>
|
||||
<h2>Contents</h2>
|
||||
<div><ol><li>Tutorial<div><ol><li><span class="RenoLink"><a href="tutorial_transporting_data.html">Tutorial: Transporting of Arbitrary Data to the Catch Site</a></span></li>
|
||||
<li><span class="RenoLink"><a href="tutorial_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies</a></span></li>
|
||||
<li><span class="RenoLink"><a href="tutorial_exception_ptr.html">Tutorial: Transporting of Exceptions Between Threads</a></span></li>
|
||||
<li><span class="RenoLink"><a href="tutorial_diagnostic_information.html">Tutorial: Diagnostic Information</a></span></li>
|
||||
<div><ol><li>Tutorial<div><ol><li><span class="RenoLink"><a href="tutorial_transporting_data.html">Transporting of Arbitrary Data to the Catch Site</a></span></li>
|
||||
<li><span class="RenoLink"><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies</a></span></li>
|
||||
<li><span class="RenoLink"><a href="tutorial_exception_ptr.html">Transporting of Exceptions Between Threads</a></span></li>
|
||||
<li><span class="RenoLink"><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></span></li>
|
||||
</ol></div>
|
||||
</li>
|
||||
<li>Documentation<div><ol><li>Class <span class="RenoLink"><a href="exception.html">exception</a></span></li>
|
||||
@ -199,7 +199,7 @@ boost
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><pre>virtual char const * <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>() const throw();</pre>
|
||||
</div><h4>Returns:</h4>
|
||||
<p>A string representation of all data stored in the boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object by the <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> function. See "<span class="RenoLink"><a href="tutorial_diagnostic_information.html">Tutorial: Diagnostic Information</a></span>" for details.</p>
|
||||
<p>A string representation of all data stored in the boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object by the <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> function. See "<span class="RenoLink"><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></span>" for details.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
<h4>Notes:</h4>
|
||||
|
@ -50,7 +50,7 @@ throw boost::<span class="RenoLink"><a href="enable_current_exception.html">enab
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_current_exception.hpp<br/>
|
||||
</a><a href="current_exception.html">current_exception<br/>
|
||||
</a><a href="tutorial_exception_ptr.html">Tutorial: Transporting of Exceptions Between Threads<br/>
|
||||
</a><a href="tutorial_exception_ptr.html">Transporting of Exceptions Between Threads<br/>
|
||||
</a><a href="throw_exception.html">throw_exception<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
|
@ -40,7 +40,7 @@ boost
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_enable_error_info_hpp.html">boost/exception/enable_error_info.hpp<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="throw_exception.html">throw_exception<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
|
@ -52,12 +52,12 @@ typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp<br/>
|
||||
</a><a href="exception_error_info_hpp.html">boost/exception/info.hpp<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||
</a><a href="exception.html">exception<br/>
|
||||
</a><a href="get_error_info.html">get_error_info<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="operator_shl_exception.html">operator<</exception<br/>
|
||||
</a><a href="operator_shl_tuple.html">operator<</tuple<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Tutorial: Diagnostic Information<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
@ -63,7 +63,7 @@ boost
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><pre>virtual char const * <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>() const throw();</pre>
|
||||
</div><h4>Returns:</h4>
|
||||
<p>A string representation of all data stored in the boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object by the <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> function. See "<span class="RenoLink"><a href="tutorial_diagnostic_information.html">Tutorial: Diagnostic Information</a></span>" for details.</p>
|
||||
<p>A string representation of all data stored in the boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object by the <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> function. See "<span class="RenoLink"><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></span>" for details.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
<h4>Notes:</h4>
|
||||
@ -74,18 +74,22 @@ boost
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO<br/>
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_exception_hpp.html">boost/exception/exception.hpp<br/>
|
||||
</a><a href="current_exception.html">current_exception<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||
</a><a href="enable_current_exception.html">enable_current_exception<br/>
|
||||
</a><a href="enable_error_info.html">enable_error_info<br/>
|
||||
</a><a href="error_info.html">error_info<br/>
|
||||
</a><a href="exception_diagnostic_information.html">exception::diagnostic_information<br/>
|
||||
</a><a href="exception_constructors.html">exception::exception<br/>
|
||||
</a><a href="exception_destructor.html">exception::~exception<br/>
|
||||
</a><a href="get_error_info.html">get_error_info<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="operator_shl_exception.html">operator<</exception<br/>
|
||||
</a><a href="operator_shl_tuple.html">operator<</tuple<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Tutorial: Diagnostic Information<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="tutorial_transporting_data.html">Tutorial: Transporting of Arbitrary Data to the Catch Site<br/>
|
||||
</a><a href="tutorial_exception_ptr.html">Tutorial: Transporting of Exceptions Between Threads<br/>
|
||||
</a><a href="tutorial_transporting_data.html">Transporting of Arbitrary Data to the Catch Site<br/>
|
||||
</a><a href="tutorial_exception_ptr.html">Transporting of Exceptions Between Threads<br/>
|
||||
</a><a href="unknown_exception.html">unknown_exception<br/>
|
||||
</a></div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
@ -23,7 +23,7 @@
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><pre>virtual char const * <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>() const throw();</pre>
|
||||
</div><h4>Returns:</h4>
|
||||
<p>A string representation of all data stored in the boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object by the <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> function. See "<span class="RenoLink"><a href="tutorial_diagnostic_information.html">Tutorial: Diagnostic Information</a></span>" for details.</p>
|
||||
<p>A string representation of all data stored in the boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object by the <span class="RenoLink"><a href="operator_shl_exception.html">operator<<</a></span> function. See "<span class="RenoLink"><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></span>" for details.</p>
|
||||
<h4>Throws:</h4>
|
||||
<p>Nothing.</p>
|
||||
<h4>Notes:</h4>
|
||||
@ -32,9 +32,9 @@
|
||||
</ul></div>
|
||||
</div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||
<div class="RenoPageList"><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||
</a><a href="diagnostic_information.html">diagnostic_information<br/>
|
||||
</a><a href="exception.html">exception<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Tutorial: Diagnostic Information<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
@ -30,8 +30,8 @@
|
||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Tutorial: Diagnostic Information<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
@ -23,6 +23,7 @@
|
||||
</div>
|
||||
<div class="RenoIndex"><h3>B</h3>
|
||||
<p><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO</a></p>
|
||||
<p><a href="boost-exception.html">Boost Exception</a></p>
|
||||
<h3>b</h3>
|
||||
<p><a href="exception_hpp.html">boost/exception.hpp</a></p>
|
||||
<p><a href="boost_exception_diagnostic_information_hpp.html">boost/exception/diagnostic_information.hpp</a></p>
|
||||
@ -37,6 +38,8 @@
|
||||
<h3>c</h3>
|
||||
<p><a href="copy_exception.html">copy_exception</a></p>
|
||||
<p><a href="current_exception.html">current_exception</a></p>
|
||||
<h3>D</h3>
|
||||
<p><a href="tutorial_diagnostic_information.html">Diagnostic Information</a></p>
|
||||
<h3>d</h3>
|
||||
<p><a href="diagnostic_information.html">diagnostic_information</a></p>
|
||||
<h3>e</h3>
|
||||
@ -50,16 +53,16 @@
|
||||
<p><a href="exception_ptr.html">exception_ptr</a></p>
|
||||
<h3>g</h3>
|
||||
<p><a href="get_error_info.html">get_error_info</a></p>
|
||||
<h3>I</h3>
|
||||
<p><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies</a></p>
|
||||
<h3>o</h3>
|
||||
<p><a href="operator_shl_exception.html">operator<</exception</a></p>
|
||||
<p><a href="operator_shl_tuple.html">operator<</tuple</a></p>
|
||||
<h3>r</h3>
|
||||
<p><a href="rethrow_exception.html">rethrow_exception</a></p>
|
||||
<h3>T</h3>
|
||||
<p><a href="tutorial_diagnostic_information.html">Tutorial: Diagnostic Information</a></p>
|
||||
<p><a href="tutorial_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies</a></p>
|
||||
<p><a href="tutorial_transporting_data.html">Tutorial: Transporting of Arbitrary Data to the Catch Site</a></p>
|
||||
<p><a href="tutorial_exception_ptr.html">Tutorial: Transporting of Exceptions Between Threads</a></p>
|
||||
<p><a href="tutorial_transporting_data.html">Transporting of Arbitrary Data to the Catch Site</a></p>
|
||||
<p><a href="tutorial_exception_ptr.html">Transporting of Exceptions Between Threads</a></p>
|
||||
<h3>t</h3>
|
||||
<p><a href="throw_exception.html">throw_exception</a></p>
|
||||
<h3>u</h3>
|
||||
|
@ -41,13 +41,13 @@ boost
|
||||
<div class="RenoPageList"><a href="BOOST_ERROR_INFO.html">BOOST_ERROR_INFO<br/>
|
||||
</a><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="exception_error_info_hpp.html">boost/exception/info.hpp<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Diagnostic Information<br/>
|
||||
</a><a href="error_info.html">error_info<br/>
|
||||
</a><a href="exception.html">exception<br/>
|
||||
</a><a href="exception_diagnostic_information.html">exception::diagnostic_information<br/>
|
||||
</a><a href="exception_constructors.html">exception::exception<br/>
|
||||
</a><a href="get_error_info.html">get_error_info<br/>
|
||||
</a><a href="tutorial_diagnostic_information.html">Tutorial: Diagnostic Information<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -47,7 +47,7 @@ boost
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="throw_exception_hpp.html">boost/throw_exception.hpp<br/>
|
||||
</a><a href="enable_current_exception.html">enable_current_exception<br/>
|
||||
</a><a href="tutorial_exception_ptr.html">Tutorial: Transporting of Exceptions Between Threads<br/>
|
||||
</a><a href="tutorial_exception_ptr.html">Transporting of Exceptions Between Threads<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
|
||||
<title>tutorial: diagnostic information</title>
|
||||
<title>diagnostic information</title>
|
||||
<link href='reno.css' type='text/css' rel='stylesheet'/>
|
||||
</head>
|
||||
<body>
|
||||
@ -19,7 +19,7 @@
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
|
||||
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>Tutorial: Diagnostic Information</h2>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>Diagnostic Information</h2>
|
||||
</div>
|
||||
<p>Class boost::<span class="RenoLink"><a href="exception.html">exception</a></span> provides a virtual member function <span class="RenoLink"><a href="exception_diagnostic_information.html">diagnostic_information</a></span>, with a signature similar to the familiar std::exception::what function. The default implementation returns a string value that is not presentable as a friendly user message, but because it is generated automatically, it is useful for debugging or logging purposes. Here is an example:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
|
||||
<title>tutorial: integrating boost exception in existing exception class hierarchies</title>
|
||||
<title>integrating boost exception in existing exception class hierarchies</title>
|
||||
<link href='reno.css' type='text/css' rel='stylesheet'/>
|
||||
</head>
|
||||
<body>
|
||||
@ -19,7 +19,7 @@
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
|
||||
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies</h2>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>Integrating Boost Exception in Existing Exception Class Hierarchies</h2>
|
||||
</div>
|
||||
<p>Some exception hierarchies can not be modified to make boost::<span class="RenoLink"><a href="exception.html">exception</a></span> a base type. In this case, the <span class="RenoLink"><a href="enable_error_info.html">enable_error_info</a></span> function template can be used to make exception objects derive from boost::<span class="RenoLink"><a href="exception.html">exception</a></span> anyway. Here is an example:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
|
||||
<title>tutorial: transporting of exceptions between threads</title>
|
||||
<title>transporting of exceptions between threads</title>
|
||||
<link href='reno.css' type='text/css' rel='stylesheet'/>
|
||||
</head>
|
||||
<body>
|
||||
@ -19,12 +19,12 @@
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
|
||||
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>Tutorial: Transporting of Exceptions Between Threads</h2>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>Transporting of Exceptions Between Threads</h2>
|
||||
</div>
|
||||
<p>Boost Exception supports transporting of exception objects between threads through cloning. This system is similar to <span class="RenoLink"><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html">N2179</a></span>, but because Boost Exception can not rely on language support, the use of <span class="RenoLink"><a href="enable_current_exception.html">enable_current_exception</a></span> at the time of the throw is required in order to use cloning.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>All exceptions emitted by the familiar function boost::<span class="RenoLink"><a href="throw_exception.html">throw_exception</a></span> are guaranteed to derive from boost::<span class="RenoLink"><a href="exception.html">exception</a></span> and to support cloning.</p>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Tutorial: Using enable_current_exception at the Time of the Throw</h3>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Using enable_current_exception at the Time of the Throw</h3>
|
||||
</div>
|
||||
<p>Here is how cloning can be enabled in a throw-expression (15.1):</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_enable_exception_cloning_hpp.html">boost/exception/enable_current_exception.hpp</a></span>>
|
||||
@ -44,7 +44,7 @@ file_read( FILE * f, void * buffer, size_t size )
|
||||
errno_info(errno);
|
||||
}</pre>
|
||||
<p>Of course, <span class="RenoLink"><a href="enable_current_exception.html">enable_current_exception</a></span> may be used with any exception type; there is no requirement that it should derive from boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Tutorial: Cloning and Re-Throwing an Exception</h3>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Cloning and Re-Throwing an Exception</h3>
|
||||
</div>
|
||||
<p>When you catch an exception, you can call <span class="RenoLink"><a href="current_exception.html">current_exception</a></span> to get an <span class="RenoLink"><a href="exception_ptr.html">exception_ptr</a></span> object:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_cloning_hpp.html">boost/exception_ptr.hpp</a></span>>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
|
||||
<title>tutorial: transporting of arbitrary data to the catch site</title>
|
||||
<title>transporting of arbitrary data to the catch site</title>
|
||||
<link href='reno.css' type='text/css' rel='stylesheet'/>
|
||||
</head>
|
||||
<body>
|
||||
@ -19,10 +19,10 @@
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
|
||||
<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>Tutorial: Transporting of Arbitrary Data to the Catch Site</h2>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h2>Transporting of Arbitrary Data to the Catch Site</h2>
|
||||
</div>
|
||||
<p>All exception types that derive from boost::<span class="RenoLink"><a href="exception.html">exception</a></span> can be used as type-safe containers of arbitrary data objects, while complying with the no-throw requirements (15.5.1) of the ANSI C++ standard for exception types. Data can be added to a boost::<span class="RenoLink"><a href="exception.html">exception</a></span> at the time of the throw, or at a later time.</p>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Tutorial: Adding of Arbitrary Data at the Point of the Throw</h3>
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Adding of Arbitrary Data at the Point of the Throw</h3>
|
||||
</div>
|
||||
<p>The following example demonstrates how errno can be stored in exception objects using Boost Exception:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_hpp.html">boost/exception.hpp</a></span>>
|
||||
@ -60,7 +60,7 @@ g()
|
||||
}
|
||||
}</pre>
|
||||
<p>The <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span> function template is instantiated with the typedef from (1), and is passed an exception object of a polymorphic type. If the exception object contains the requested value, the returned <span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span> will point to it; otherwise an empty <span class="RenoLink"><a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">shared_ptr</a></span> is returned.</p>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Tutorial: Adding of Arbitrary Data to Active Exception Objects</h3>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Adding of Arbitrary Data to Active Exception Objects</h3>
|
||||
</div>
|
||||
<p>Sometimes the throw site does not have all the information that is needed at the catch site to make sense of what went wrong. Here is an example:</p>
|
||||
<pre>#include <stdio.h>
|
||||
@ -141,7 +141,7 @@ parse_file( char const * file_name )
|
||||
}</pre>
|
||||
<p>The above function is (almost) exception-neutral -- if an exception is emitted by any function call within the try block, parse_file does not need to do any real work, but it intercepts any boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object, stores the file name, and re-throws using a throw-expression with no operand (15.1.6). The rationale for catching any boost::<span class="RenoLink"><a href="exception.html">exception</a></span> object is that the file name is relevant to any failure that occurs in parse_file, <i>even if the failure is unrelated to file I/O</i>.</p>
|
||||
<p>As usual, the stored data can be retrieved using <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>.</p>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Tutorial: Adding Grouped Data to Exceptions</h3>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Adding Grouped Data to Exceptions</h3>
|
||||
</div>
|
||||
<p>The code snippet below demonstrates how boost::<span class="RenoLink"><a href="http://www.boost.org/libs/tuple/doc/tuple_users_guide.html">tuple</a></span> can be used to bundle the name of the function that failed, together with the reported errno so that they can be added to exception objects more conveniently together:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_error_info_group_hpp.html">boost/exception/info_tuple.hpp</a></span>>
|
||||
@ -171,7 +171,7 @@ file_open( char const * name, char const * mode )
|
||||
</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
|
||||
<h3>See Also:</h3>
|
||||
<div class="RenoPageList"><a href="boost-exception.html">Boost Exception<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Tutorial: Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a><a href="tutorial_enable_error_info.html">Integrating Boost Exception in Existing Exception Class Hierarchies<br/>
|
||||
</a></div>
|
||||
</div>
|
||||
<!-- Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. -->
|
||||
|
Reference in New Issue
Block a user