Quick Links:

bal | bbl | bdl | bsl

Namespaces

Component bslx_testinstreamexception
[Package bslx]

Provide an exception class for unexternalization operations. More...

Namespaces

namespace  bslx

Detailed Description

Outline
Purpose:
Provide an exception class for unexternalization operations.
Classes:
bslx::TestInStreamException exception containing unexternalization info
See also:
Component bslx_testinstream
Description:
This component defines a simple exception object for testing exceptions during unexternalization operations. The exception object bslx::TestInStreamException contains information about an unexternalization request, which can be queried by the "catcher" of the exception.
Usage:
This section illustrates intended use of this component.
Example 1: Throw and Catch:
In the following example, the bslx::TestInStreamException object is thrown, caught, and examined. First, set up a try block and throw the exception with the indication that the exception occurred during unexternalization of an unsigned int:
  try {
      throw TestInStreamException(bslx::TypeCode::e_UINT32);
Then, catch the exception and verify the indicated cause of the exception:
  } catch (const bslx::TestInStreamException& e) {
      assert(bslx::TypeCode::e_UINT32 == e.dataType());
  }