CppWAMP
C++11 client library for the WAMP protocol
error.hpp File Reference

Contains facilities for reporting and describing errors. More...

#include <sstream>
#include <stdexcept>
#include <string>
#include <system_error>
#include "api.hpp"
#include "config.hpp"
#include "internal/error.ipp"

Go to the source code of this file.

Classes

class  wamp::error::Failure
 General purpose runtime exception that wraps a std::error_code. More...
 
struct  wamp::error::Logic
 Exception thrown when a pre-condition is not met. More...
 
struct  wamp::error::BadType
 Base class for exceptions involving invalid Variant types. More...
 
struct  wamp::error::Access
 Exception type thrown when accessing a Variant as an invalid type. More...
 
struct  wamp::error::Conversion
 Exception type thrown when converting a Variant to an invalid type. More...
 
struct  wamp::error::Decode
 Exception type thrown when codec deserialization fails. More...
 
class  wamp::SessionCategory
 std::error_category used for reporting errors at the WAMP session layer. More...
 
class  wamp::DecodingCategory
 std::error_category used for reporting deserialization errors. More...
 
class  wamp::ProtocolCategory
 std::error_category used for reporting protocol errors related to invalid WAMP messages. More...
 
class  wamp::TransportCategory
 std::error_category used for reporting errors at the transport layer. More...
 
class  wamp::RawsockCategory
 std::error_category used for reporting errors specific to raw socket transports. More...
 

Namespaces

 wamp
 
 wamp::error
 

Macros

#define CPPWAMP_LOGIC_ERROR(msg)   error::Logic::raise(__FILE__, __LINE__, (msg));
 Throws an error::Logic exception having the given message string. More...
 
#define CPPWAMP_LOGIC_CHECK(cond, msg)   {error::Logic::check((cond), __FILE__, __LINE__, (msg));}
 Conditionally throws an error::Logic exception having the given message string. More...
 

Enumerations

enum  wamp::SessionErrc {
  wamp::SessionErrc::success = 0,
  wamp::SessionErrc::sessionEnded,
  wamp::SessionErrc::sessionEndedByPeer,
  wamp::SessionErrc::allTransportsFailed,
  wamp::SessionErrc::joinError,
  wamp::SessionErrc::publishError,
  wamp::SessionErrc::subscribeError,
  wamp::SessionErrc::unsubscribeError,
  wamp::SessionErrc::registerError,
  wamp::SessionErrc::unregisterError,
  wamp::SessionErrc::callError,
  wamp::SessionErrc::invalidState,
  wamp::SessionErrc::invalidUri,
  wamp::SessionErrc::noSuchProcedure,
  wamp::SessionErrc::procedureAlreadyExists,
  wamp::SessionErrc::noSuchRegistration,
  wamp::SessionErrc::noSuchSubscription,
  wamp::SessionErrc::invalidArgument,
  wamp::SessionErrc::systemShutdown,
  wamp::SessionErrc::closeRealm,
  wamp::SessionErrc::goodbyeAndOut,
  wamp::SessionErrc::notAuthorized,
  wamp::SessionErrc::authorizationFailed,
  wamp::SessionErrc::noSuchRealm,
  wamp::SessionErrc::noSuchRole,
  wamp::SessionErrc::cancelled,
  wamp::SessionErrc::optionNotAllowed,
  wamp::SessionErrc::noEligibleCallee,
  wamp::SessionErrc::discloseMeDisallowed,
  wamp::SessionErrc::networkFailure
}
 Error code values used with the SessionCategory error category. More...
 
enum  wamp::DecodingErrc {
  wamp::DecodingErrc::success = 0,
  wamp::DecodingErrc::failure = 1,
  wamp::DecodingErrc::emptyInput = 2,
  wamp::DecodingErrc::expectedStringKey = 3,
  wamp::DecodingErrc::badBase64Length = 4,
  wamp::DecodingErrc::badBase64Padding = 5,
  wamp::DecodingErrc::badBase64Char = 6
}
 Error code values used with the DecodingCategory error category. More...
 
enum  wamp::ProtocolErrc {
  wamp::ProtocolErrc::success = 0,
  wamp::ProtocolErrc::badDecode,
  wamp::ProtocolErrc::badSchema,
  wamp::ProtocolErrc::unsupportedMsg,
  wamp::ProtocolErrc::unexpectedMsg
}
 Error code values used with the ProtocolCategory error category. More...
 
enum  wamp::TransportErrc {
  wamp::TransportErrc::success = 0,
  wamp::TransportErrc::aborted = 1,
  wamp::TransportErrc::failed = 2,
  wamp::TransportErrc::badTxLength = 3,
  wamp::TransportErrc::badRxLength = 4
}
 Error code values used with the TransportCategory error category. More...
 
enum  wamp::RawsockErrc {
  wamp::RawsockErrc::success = 0,
  wamp::RawsockErrc::badSerializer = 1,
  wamp::RawsockErrc::badMaxLength = 2,
  wamp::RawsockErrc::reservedBitsUsed = 3,
  wamp::RawsockErrc::maxConnectionsReached = 4,
  wamp::RawsockErrc::badHandshake = 16,
  wamp::RawsockErrc::badMessageType = 17
}
 Error code values used with the RawsockCategory error category. More...
 

Detailed Description

Contains facilities for reporting and describing errors.

Macro Definition Documentation

◆ CPPWAMP_LOGIC_ERROR

#define CPPWAMP_LOGIC_ERROR (   msg)    error::Logic::raise(__FILE__, __LINE__, (msg));

Throws an error::Logic exception having the given message string.

Parameters
msgA string describing the cause of the exception.

◆ CPPWAMP_LOGIC_CHECK

#define CPPWAMP_LOGIC_CHECK (   cond,
  msg 
)    {error::Logic::check((cond), __FILE__, __LINE__, (msg));}

Conditionally throws an error::Logic exception having the given message string.

Parameters
condA boolean expression that, if true, will cause an exception to be thrown.
msgA string describing the cause of the exception.