# Boost Exception

## 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
   1. Transporting of Arbitrary Data to the Catch Site
   2. Integrating Boost Exception in Existing Exception Class Hierarchies
   3. Transporting of Exceptions Between Threads
   4. Exception Types as Simple Semantic Tags
   5. Using Virtual Inheritance in Exception Types
   6. Diagnostic Information
3. Documentation
   1. Class exception
   2. Throwing Exceptions
      1. BOOST_THROW_EXCEPTION
      2. throw_exception
   3. Transporting of Arbitrary Data to the Catch Site
      1. error_info
      2. exception/operator<<
      3. tuple/operator<<
      4. get_error_info
      5. enable_error_info
   4. N2179 Transporting of Exceptions between Threads
      1. exception_ptr
      2. enable_current_exception
      3. current_exception
      4. copy_exception
      5. rethrow_exception
      6. unknown_exception
   5. Diagnostic Information
      1. diagnostic_information
      2. current_exception_diagnostic_information
   6. current_exception_cast
4. API
   1. Synopsis
   2. Headers
   3. Types
   4. Functions
   5. Macros
   6. Configuration Macros
5. Frequently Asked Questions
6. 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.