hamcast  Version 0.7
Classes | Macros | Enumerations
Exception handling.

Classes

class  hamcast::connection_to_middleware_failed
 
class  hamcast::connection_to_middleware_lost
 
class  hamcast::internal_interface_error
 
class  hamcast::requirement_failed
 

Macros

#define HC_REQUIRE(req)
 
#define HC_REQUIRE_VERBOSE(req, verbose_msg)
 

Enumerations

enum  hamcast::connection_error {
  hamcast::no_config_file_found,
  hamcast::no_running_middleware_found,
  hamcast::socket_creation_failed,
  hamcast::incompatible_middleware_found
}
 

Detailed Description

All HAMcast exceptions inherit std::exception.

connection_to_middleware_failed and connection_to_middleware_lost are thrown by libhamcast if communication to the middleware couldn't be established or is interrupted. A libhamcast based application terminates if one of those exception was thrown.

internal_interface_error is thrown if an unexpected exception occurs in a middleware module. This exception is forwarded to the client on IPC calls.

requirement_failed is thrown if you call member functions of an opject that's in an invalid state or if you pass invalid parameters to a function.

Macro Definition Documentation

#define HC_REQUIRE (   req)
Value:
if (!(req)) \
{ \
HC_LOG_FATAL("Requirement failed: " << BOOST_STRINGIZE(req)); \
throw ::hamcast:: \
requirement_failed( __LINE__ , __FILE__ , BOOST_STRINGIZE(req) ); \
}

Similiar to assert() but throws an exception if the requirement fails instead of calling terminate() and also logs the error with HC_LOG_FATAL().

Parameters
reqThe requirement (source code).
Exceptions
hamcast::requirement_failed
#define HC_REQUIRE_VERBOSE (   req,
  verbose_msg 
)
Value:
if (!(req)) \
{ \
HC_LOG_FATAL("Requirement failed: " << BOOST_STRINGIZE(req)); \
std::ostringstream err; \
err << verbose_msg ; \
throw ::hamcast:: \
requirement_failed( __LINE__ , __FILE__ , err.str() ); \
}

Equal to HC_REQUIRE(req) but uses verbose_msg as as error message instead of req.

Parameters
reqThe requirement (source code).
verbose_msgAn expression that could use shift operations and results in an string.
Exceptions
hamcast::requirement_failed

Enumeration Type Documentation

Describes all possible errors that can occur if you try to establish a connection to the middleware.

Enumerator
no_config_file_found 

Indicates that no config file of the middleware was found.

This usually means that no middleware is running.

no_running_middleware_found 

Indicates that there is currently no middleware is running.

socket_creation_failed 

Indicates that a socket creation failed.

incompatible_middleware_found 

Indicates that the middleware is not compatible with the client.