Back to Arangodb

Boost Exception

3rdParty/boost/1.78.0/libs/exception/doc/boost-exception.html

3.12.9.14.3 KB
Original Source

Boost Exception

NOTE: When targeting C++11 or newer and Boost 1.75 or newer is available, it is recommended to use Boost LEAF instead of Boost Exception. LEAF serves a similar purpose but it has a more elegant interface, it is more efficient, and works with or without exception handling -- yet understands Boost Exception error information for compatibility with legacy source code. This overview explains the differences between the two APIs (Boost Exception is not deprecated and will continue to be supported, including C++03 compatibility).

Introduction

The purpose of Boost Exception is to ease the design of exception class hierarchies and to help write exception handling and error reporting code.

It supports transporting of arbitrary data to the catch site, which is otherwise tricky due to the no-throw requirements (15.5.1) for exception types. Data can be added to any exception object, either directly in the throw-expression (15.1), or at a later time as the exception object propagates up the call stack.

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.

Boost Exception also supports N2179-style copying of exception objects, implemented non-intrusively and automatically by the boost::throw_exception function.

Contents

  1. Motivation

  2. Tutorial

  3. Transporting of Arbitrary Data to the Catch Site

  4. Integrating Boost Exception in Existing Exception Class Hierarchies

  5. Transporting of Exceptions Between Threads

  6. Exception Types as Simple Semantic Tags

  7. Using Virtual Inheritance in Exception Types

  8. Diagnostic Information

  9. Documentation

  10. Class exception

  11. Throwing Exceptions

1. [BOOST\_THROW\_EXCEPTION](BOOST_THROW_EXCEPTION.html)
2. [throw\_exception](throw_exception.html)

3. Transporting of Arbitrary Data to the Catch Site

1. [error\_info](error_info.html)
2. [exception/operator\<\<](exception_operator_shl.html)
3. [tuple/operator\<\<](tuple_operator_shl.html)
4. [get\_error\_info](get_error_info.html)
5. [enable\_error\_info](enable_error_info.html)

4. N2179 Transporting of Exceptions between Threads

1. [exception\_ptr](exception_ptr.html)
2. [enable\_current\_exception](enable_current_exception.html)
3. [current\_exception](current_exception.html)
4. [copy\_exception](copy_exception.html)
5. [rethrow\_exception](rethrow_exception.html)
6. [unknown\_exception](unknown_exception.html)

5. Diagnostic Information

1. [diagnostic\_information](diagnostic_information.html)
2. [current\_exception\_diagnostic\_information](current_exception_diagnostic_information.html)

6. current_exception_cast

  1. API

  2. Synopsis

  3. Headers

  4. Types

  5. Functions

  6. Macros

  7. Configuration Macros

  8. Frequently Asked Questions

  9. Page Index

Acknowledgements

Thanks to Peter Dimov for his continuing help. Also thanks to Tobias Schwinger, Tom Brinkman, Pavel Vozenilek and everyone who participated in the review process.

Copyright (c) 2006-2009 by Emil Dotchevski and Reverge Studios, Inc.
Distributed under the Boost Software License, Version 1.0.