Classes | Defines | Enumerations

Exception handling.

All HAMcast exceptions inherit std::exception. More...

Classes

class  hamcast::connection_to_middleware_failed
 Thrown to indicate that the client was unable to connect to a running HAMcast middleware. More...
class  hamcast::connection_to_middleware_lost
 Thrown to indicate that the client lost the connection to the middleware. More...
class  hamcast::internal_interface_error
 Thrown to indicate that an IPC call failed because of an internal interface error. More...
class  hamcast::requirement_failed
 Thrown by HC_REQUIRE(req) and HC_REQUIRE_VERBOSE(req,verbose_msg) if the requirement req evaluates to false. More...

Defines

#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.


Define 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:
req The 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:
req The requirement (source code).
verbose_msg An 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.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator