Exceptions.h
Go to the documentation of this file.
/* -*- C++ -*- */
/****************************************************************************
** Copyright (c) 2001-2014
**
** This file is part of the QuickFIX FIX Engine
**
** This file may be distributed under the terms of the quickfixengine.org
** license as defined by quickfixengine.org and appearing in the file
** LICENSE included in the packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.quickfixengine.org/LICENSE for licensing information.
**
** Contact ask@quickfixengine.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef FIX_EXCEPTIONS_H
#define FIX_EXCEPTIONS_H
#include <string>
#include <stdexcept>
#include "Utility.h"
namespace FIX
{
struct Exception : public std::logic_error
{
Exception( const std::string& t, const std::string& d )
: std::logic_error( d.size() ? t + ": " + d : t ),
type( t ), detail( d )
{}
~Exception() throw() {}
std::string type;
std::string detail;
};
struct DataDictionaryNotFound : public Exception
{
DataDictionaryNotFound( const std::string& v, const std::string& what = "" )
: Exception( "Could not find data dictionary", what ),
version( v ) {}
~DataDictionaryNotFound() throw() {}
std::string version;
};
struct FieldNotFound : public Exception
{
FieldNotFound( int f = 0, const std::string& what = "" )
: Exception( "Field not found", what ),
field( f ) {}
int field;
};
struct FieldConvertError : public Exception
{
FieldConvertError( const std::string& what = "" )
: Exception( "Could not convert field", what ) {}
};
struct MessageParseError : public Exception
{
MessageParseError( const std::string& what = "" )
: Exception( "Could not parse message", what ) {}
};
struct InvalidMessage : public Exception
{
InvalidMessage( const std::string& what = "" )
: Exception( "Invalid message", what ) {}
};
struct ConfigError : public Exception
{
ConfigError( const std::string& what = "" )
: Exception( "Configuration failed", what ) {}
};
struct RuntimeError : public Exception
{
RuntimeError( const std::string& what = "" )
: Exception( "Runtime error", what ) {}
};
struct InvalidTagNumber : public Exception
{
InvalidTagNumber( int f = 0, const std::string& what = "" )
: Exception( "Invalid tag number", what ),
field( f ) {}
int field;
};
struct RequiredTagMissing : public Exception
{
RequiredTagMissing( int f = 0, const std::string& what = "" )
: Exception( "Required tag missing", what ),
field( f ) {}
int field;
};
struct TagNotDefinedForMessage : public Exception
{
TagNotDefinedForMessage( int f = 0, const std::string& what = "" )
: Exception( "Tag not defined for this message type", what ),
field( f ) {}
int field;
};
struct NoTagValue : public Exception
{
NoTagValue( int f = 0, const std::string& what = "" )
: Exception( "Tag specified without a value", what ),
field( f ) {}
int field;
};
struct IncorrectTagValue : public Exception
{
IncorrectTagValue( int f = 0, const std::string& what = "" )
: Exception( "Value is incorrect (out of range) for this tag", what ),
field( f ) {}
int field;
};
struct IncorrectDataFormat : public Exception
{
IncorrectDataFormat( int f = 0, const std::string& what = "" )
: Exception( "Incorrect data format for value", what ),
field( f ) {}
int field;
};
struct IncorrectMessageStructure : public Exception
{
IncorrectMessageStructure( const std::string& what = "" )
: Exception( "Incorrect message structure", what ) {}
};
struct DuplicateFieldNumber : public Exception
{
DuplicateFieldNumber( const std::string& what = "" )
: Exception( "Duplicate field number", what ) {}
};
struct InvalidMessageType : public Exception
{
InvalidMessageType( const std::string& what = "" )
: Exception( "Invalid Message Type", what ) {}
};
struct UnsupportedMessageType : public Exception
{
UnsupportedMessageType( const std::string& what = "" )
: Exception( "Unsupported Message Type", what ) {}
};
struct UnsupportedVersion : public Exception
{
UnsupportedVersion( const std::string& what = "" )
: Exception( "Unsupported Version", what ) {}
};
struct TagOutOfOrder : public Exception
{
TagOutOfOrder( int f = 0, const std::string& what = "" )
: Exception( "Tag specified out of required order", what ),
field( f ) {}
int field;
};
struct RepeatedTag : public Exception
{
RepeatedTag( int f = 0, const std::string& what = "" )
: Exception( "Repeated tag not part of repeating group", what ),
field( f ) {}
int field;
};
struct RepeatingGroupCountMismatch : public Exception
{
RepeatingGroupCountMismatch( int f = 0, const std::string& what = "" )
: Exception( "Repeating group count mismatch", what ),
field( f ) {}
int field;
};
struct DoNotSend : public Exception
{
DoNotSend( const std::string& what = "" )
: Exception( "Do Not Send Message", what ) {}
};
struct RejectLogon : public Exception
{
RejectLogon( const std::string& what = "" )
: Exception( "Rejected Logon Attempt", what ) {}
};
struct SessionNotFound : public Exception
{
SessionNotFound( const std::string& what = "" )
: Exception( "Session Not Found", what ) {}
};
struct IOException : public Exception
{
IOException( const std::string& what = "" )
: Exception( "IO Error", what ) {}
};
struct SocketException : public Exception
{
SocketException()
: Exception( "Socket Error", errorToWhat() ) {}
SocketException( const std::string& what )
: Exception( "Socket Error", what ) {}
std::string errorToWhat()
{
#ifdef _MSC_VER
error = WSAGetLastError();
char buffer[2048];
FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM, NULL, error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
buffer, 2048, NULL );
return buffer;
#else
error = errno;
return strerror( error );
#endif
}
int error;
};
struct SocketSendFailed : public SocketException
{
SocketSendFailed() {}
SocketSendFailed( const std::string& what )
: SocketException( what ) {}
};
struct SocketRecvFailed : public SocketException
{
SocketRecvFailed( ssize_t size )
: SocketException( size == 0 ? "Connection reset by peer." : size < 0 ? errorToWhat() : "Success." ) {}
SocketRecvFailed( const std::string& what )
: SocketException( what ) {}
};
struct SocketCloseFailed : public SocketException
{
SocketCloseFailed() {}
SocketCloseFailed( const std::string& what )
: SocketException( what ) {}
};
}
#endif //FIX_EXCEPTIONS_H
FIX::RepeatingGroupCountMismatch::RepeatingGroupCountMismatch
RepeatingGroupCountMismatch(int f=0, const std::string &what="")
Definition: Exceptions.h:210
FIX::FieldConvertError
Unable to convert field into its native format.
Definition: Exceptions.h:66
FIX::IncorrectDataFormat
Field has a badly formatted value.
Definition: Exceptions.h:146
FIX::DataDictionaryNotFound::version
std::string version
Definition: Exceptions.h:53
FIX::UnsupportedMessageType
Message type not supported by application.
Definition: Exceptions.h:176
FIX::IncorrectTagValue::IncorrectTagValue
IncorrectTagValue(int f=0, const std::string &what="")
Definition: Exceptions.h:139
FIX::RepeatingGroupCountMismatch
Repeated group count not equal to actual count.
Definition: Exceptions.h:208
FIX::IncorrectTagValue::field
int field
Definition: Exceptions.h:142
FIX::SocketSendFailed::SocketSendFailed
SocketSendFailed()
Definition: Exceptions.h:274
FIX::MessageParseError
Unable to parse message.
Definition: Exceptions.h:73
FIX::RepeatedTag
Repeated tag not part of repeating group.
Definition: Exceptions.h:199
FIX::SessionNotFound
Session cannot be found for specified action.
Definition: Exceptions.h:231
Utility.h
FIX::DataDictionaryNotFound::~DataDictionaryNotFound
~DataDictionaryNotFound()
Definition: Exceptions.h:51
FIX::RejectLogon::RejectLogon
RejectLogon(const std::string &what="")
Definition: Exceptions.h:226
FIX::RequiredTagMissing::field
int field
Definition: Exceptions.h:115
FIX::TagNotDefinedForMessage::field
int field
Definition: Exceptions.h:124
FIX::RepeatedTag::RepeatedTag
RepeatedTag(int f=0, const std::string &what="")
Definition: Exceptions.h:201
FIX::InvalidTagNumber::field
int field
Definition: Exceptions.h:106
FIX::SocketCloseFailed::SocketCloseFailed
SocketCloseFailed(const std::string &what)
Definition: Exceptions.h:292
FIX::DataDictionaryNotFound
DataDictionary not found for BeginString or ApplVerID.
Definition: Exceptions.h:46
FIX::NoTagValue::NoTagValue
NoTagValue(int f=0, const std::string &what="")
Definition: Exceptions.h:130
FIX::IncorrectMessageStructure
Message is not structured correctly.
Definition: Exceptions.h:155
FIX::Exception::detail
std::string detail
Definition: Exceptions.h:42
FIX::DoNotSend::DoNotSend
DoNotSend(const std::string &what="")
Definition: Exceptions.h:219
FIX::Exception::Exception
Exception(const std::string &t, const std::string &d)
Definition: Exceptions.h:35
FIX::InvalidTagNumber
Tag number does not exist in specification.
Definition: Exceptions.h:101
FIX::FieldNotFound::FieldNotFound
FieldNotFound(int f=0, const std::string &what="")
Definition: Exceptions.h:59
FIX::RepeatingGroupCountMismatch::field
int field
Definition: Exceptions.h:213
FIX::RepeatedTag::field
int field
Definition: Exceptions.h:204
FIX::InvalidTagNumber::InvalidTagNumber
InvalidTagNumber(int f=0, const std::string &what="")
Definition: Exceptions.h:103
FIX
Definition: Acceptor.cpp:34
FIX::SocketException::error
int error
Definition: Exceptions.h:268
FIX::Exception::~Exception
~Exception()
Definition: Exceptions.h:39
FIX::SocketRecvFailed
Socket recv operation failed.
Definition: Exceptions.h:280
FIX::UnsupportedVersion::UnsupportedVersion
UnsupportedVersion(const std::string &what="")
Definition: Exceptions.h:185
FIX::SocketRecvFailed::SocketRecvFailed
SocketRecvFailed(const std::string &what)
Definition: Exceptions.h:284
FIX::InvalidMessageType
Not a known message type.
Definition: Exceptions.h:169
FIX::TagOutOfOrder::field
int field
Definition: Exceptions.h:195
FIX::RuntimeError
Application encountered serious error during runtime
Definition: Exceptions.h:94
FIX::ConfigError
Application is not configured correctly
Definition: Exceptions.h:87
FIX::UnsupportedVersion
Version of FIX is not supported.
Definition: Exceptions.h:183
FIX::DuplicateFieldNumber
Field shows up twice in the message.
Definition: Exceptions.h:162
FIX::FieldNotFound::field
int field
Definition: Exceptions.h:62
FIX::MessageParseError::MessageParseError
MessageParseError(const std::string &what="")
Definition: Exceptions.h:75
FIX::InvalidMessage::InvalidMessage
InvalidMessage(const std::string &what="")
Definition: Exceptions.h:82
FIX::TagOutOfOrder
Tag is not in the correct order.
Definition: Exceptions.h:190
FIX::IncorrectDataFormat::IncorrectDataFormat
IncorrectDataFormat(int f=0, const std::string &what="")
Definition: Exceptions.h:148
FIX::FieldNotFound
Field not found inside a message.
Definition: Exceptions.h:57
FIX::Exception::type
std::string type
Definition: Exceptions.h:41
FIX::DuplicateFieldNumber::DuplicateFieldNumber
DuplicateFieldNumber(const std::string &what="")
Definition: Exceptions.h:164
FIX::SessionNotFound::SessionNotFound
SessionNotFound(const std::string &what="")
Definition: Exceptions.h:233
FIX::SocketCloseFailed
Socket close operation failed.
Definition: Exceptions.h:289
FIX::RuntimeError::RuntimeError
RuntimeError(const std::string &what="")
Definition: Exceptions.h:96
FIX::SocketSendFailed::SocketSendFailed
SocketSendFailed(const std::string &what)
Definition: Exceptions.h:275
FIX::DoNotSend
Indicates user does not want to send a message.
Definition: Exceptions.h:217
FIX::SocketException
Socket Error.
Definition: Exceptions.h:245
FIX::SocketCloseFailed::SocketCloseFailed
SocketCloseFailed()
Definition: Exceptions.h:291
FIX::RequiredTagMissing::RequiredTagMissing
RequiredTagMissing(int f=0, const std::string &what="")
Definition: Exceptions.h:112
FIX::SocketException::SocketException
SocketException(const std::string &what)
Definition: Exceptions.h:250
FIX::FieldConvertError::FieldConvertError
FieldConvertError(const std::string &what="")
Definition: Exceptions.h:68
FIX::SocketException::SocketException
SocketException()
Definition: Exceptions.h:247
FIX::IncorrectMessageStructure::IncorrectMessageStructure
IncorrectMessageStructure(const std::string &what="")
Definition: Exceptions.h:157
FIX::IOException::IOException
IOException(const std::string &what="")
Definition: Exceptions.h:240
FIX::IncorrectDataFormat::field
int field
Definition: Exceptions.h:151
FIX::RequiredTagMissing
Required field is not in message.
Definition: Exceptions.h:110
FIX::NoTagValue
Field exists in message without a value.
Definition: Exceptions.h:128
FIX::IncorrectTagValue
Field has a value that is out of range.
Definition: Exceptions.h:137
FIX::ConfigError::ConfigError
ConfigError(const std::string &what="")
Definition: Exceptions.h:89
FIX::InvalidMessage
Not a recognizable message.
Definition: Exceptions.h:80
FIX::RejectLogon
User wants to reject permission to logon.
Definition: Exceptions.h:224
FIX::SocketException::errorToWhat
std::string errorToWhat()
Definition: Exceptions.h:253
FIX::TagNotDefinedForMessage
Field does not belong to message.
Definition: Exceptions.h:119
FIX::TagOutOfOrder::TagOutOfOrder
TagOutOfOrder(int f=0, const std::string &what="")
Definition: Exceptions.h:192
FIX::UnsupportedMessageType::UnsupportedMessageType
UnsupportedMessageType(const std::string &what="")
Definition: Exceptions.h:178
FIX::NoTagValue::field
int field
Definition: Exceptions.h:133
FIX::IOException
IO Error.
Definition: Exceptions.h:238
FIX::SocketRecvFailed::SocketRecvFailed
SocketRecvFailed(ssize_t size)
Definition: Exceptions.h:282
FIX::SocketSendFailed
Socket send operation failed.
Definition: Exceptions.h:272
FIX::DataDictionaryNotFound::DataDictionaryNotFound
DataDictionaryNotFound(const std::string &v, const std::string &what="")
Definition: Exceptions.h:48
FIX::Exception
Base QuickFIX exception type.
Definition: Exceptions.h:33
FIX::TagNotDefinedForMessage::TagNotDefinedForMessage
TagNotDefinedForMessage(int f=0, const std::string &what="")
Definition: Exceptions.h:121
FIX::InvalidMessageType::InvalidMessageType
InvalidMessageType(const std::string &what="")
Definition: Exceptions.h:171