AgentXcpp  Version:0.3
Internals Documentation
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Pages
Exception Handling

In agentXcpp, errors are reported using the C++ exception mechanism. As error reporting and handling is a non-local issue, the following strategy is used throughout the library:

  • All used exceptions are defined in exception.hpp.
  • All used exceptions inherit from the class std::exception or from one of its subclasses.
  • Exception specifications are NOT used. These are checked at runtime, not at compile time, and illegal exceptions lead to a call to unexpected(), which by default terminates the program. This is not useful.
  • Errors are reported as exceptions. No other techniques are used to report errors.
  • Exceptions mean errors. For example, MasterProxy::is_connected() does not throw an exception to indicate that the MasterProxy object is disconnected.
  • Each possible exception is documented. For each function, the possible exceptions are documented, including exceptions which might been thrown indirectly. For example, if f() calls g(), and g() uses new (which might throw bad_alloc), then bad_alloc is documented as possible exception for g() and f() (unless it is caught in f() or g(), of course).