Chapter 9. Handling exceptions

 

This chapter covers

  • Understanding the Apache Thrift Exception Model
  • Handling transport, protocol, and application exceptions
  • Creating and working with user-defined exceptions
  • Designing Apache Thrift programs with robust exception processing

The Apache Thrift framework can face a range of error conditions, including disk errors, network errors, and security violations. Many of these error conditions can occur completely independently of any coding flaws in user code or Apache Thrift. For example, consider a network client communicating with a server over a wireless connection that goes down. The failed wireless link will cause any attempt at communication between the client and server to result in an unexpected error.

Many programming languages support exception processing as a means for managing errors separately from an application’s normal flow of control. Exception processing is often associated with object technology, but is supported by a variety of languages and platforms.

Apache Thrift adopts the exception processing model as its abstract model for managing errors. Languages that don’t support exceptions, for example C and Go, return error values instead.

9.1. Apache Thrift exceptions

9.2. TTransportException

9.3. TProtocolException

9.4. TApplicationException

9.5. User-defined exceptions

Summary