Exceptions.h
Go to the documentation of this file.
1/* -*- C++ -*- */
2
3/****************************************************************************
4** Copyright (c) 2001-2014
5**
6** This file is part of the QuickFIX FIX Engine
7**
8** This file may be distributed under the terms of the quickfixengine.org
9** license as defined by quickfixengine.org and appearing in the file
10** LICENSE included in the packaging of this file.
11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14**
15** See http://www.quickfixengine.org/LICENSE for licensing information.
16**
17** Contact ask@quickfixengine.org if any conditions of this licensing are
18** not clear to you.
19**
20****************************************************************************/
21
22#ifndef FIX_EXCEPTIONS_H
23#define FIX_EXCEPTIONS_H
24
25#include <string>
26#include <stdexcept>
27#include "Utility.h"
28
29namespace FIX
30{
31
33struct Exception : public std::logic_error
34{
35 Exception( const std::string& t, const std::string& d )
36 : std::logic_error( d.size() ? t + ": " + d : t ),
37 type( t ), detail( d )
38 {}
39 ~Exception() throw() {}
40
41 std::string type;
42 std::string detail;
43};
44
47{
48 DataDictionaryNotFound( const std::string& v, const std::string& what = "" )
49 : Exception( "Could not find data dictionary", what ),
50 version( v ) {}
52
53 std::string version;
54};
55
57struct FieldNotFound : public Exception
58{
59 FieldNotFound( int f = 0, const std::string& what = "" )
60 : Exception( "Field not found", what ),
61 field( f ) {}
62 int field;
63};
64
67{
68 FieldConvertError( const std::string& what = "" )
69 : Exception( "Could not convert field", what ) {}
70};
71
74{
75 MessageParseError( const std::string& what = "" )
76 : Exception( "Could not parse message", what ) {}
77};
78
81{
82 InvalidMessage( const std::string& what = "" )
83 : Exception( "Invalid message", what ) {}
84};
85
87struct ConfigError : public Exception
88{
89 ConfigError( const std::string& what = "" )
90 : Exception( "Configuration failed", what ) {}
91};
92
94struct RuntimeError : public Exception
95{
96 RuntimeError( const std::string& what = "" )
97 : Exception( "Runtime error", what ) {}
98};
99
102{
103 InvalidTagNumber( int f = 0, const std::string& what = "" )
104 : Exception( "Invalid tag number", what ),
105 field( f ) {}
106 int field;
107};
108
111{
112 RequiredTagMissing( int f = 0, const std::string& what = "" )
113 : Exception( "Required tag missing", what ),
114 field( f ) {}
115 int field;
116};
117
120{
121 TagNotDefinedForMessage( int f = 0, const std::string& what = "" )
122 : Exception( "Tag not defined for this message type", what ),
123 field( f ) {}
124 int field;
125};
126
128struct NoTagValue : public Exception
129{
130 NoTagValue( int f = 0, const std::string& what = "" )
131 : Exception( "Tag specified without a value", what ),
132 field( f ) {}
133 int field;
134};
135
138{
139 IncorrectTagValue( int f = 0, const std::string& what = "" )
140 : Exception( "Value is incorrect (out of range) for this tag", what ),
141 field( f ) {}
142 int field;
143};
144
147{
148 IncorrectDataFormat( int f = 0, const std::string& what = "" )
149 : Exception( "Incorrect data format for value", what ),
150 field( f ) {}
151 int field;
152};
153
156{
157 IncorrectMessageStructure( const std::string& what = "" )
158 : Exception( "Incorrect message structure", what ) {}
159};
160
163{
164 DuplicateFieldNumber( const std::string& what = "" )
165 : Exception( "Duplicate field number", what ) {}
166};
167
170{
171 InvalidMessageType( const std::string& what = "" )
172 : Exception( "Invalid Message Type", what ) {}
173};
174
177{
178 UnsupportedMessageType( const std::string& what = "" )
179 : Exception( "Unsupported Message Type", what ) {}
180};
181
184{
185 UnsupportedVersion( const std::string& what = "" )
186 : Exception( "Unsupported Version", what ) {}
187};
188
191{
192 TagOutOfOrder( int f = 0, const std::string& what = "" )
193 : Exception( "Tag specified out of required order", what ),
194 field( f ) {}
195 int field;
196};
197
199struct RepeatedTag : public Exception
200{
201 RepeatedTag( int f = 0, const std::string& what = "" )
202 : Exception( "Repeated tag not part of repeating group", what ),
203 field( f ) {}
204 int field;
205};
206
209{
210 RepeatingGroupCountMismatch( int f = 0, const std::string& what = "" )
211 : Exception( "Repeating group count mismatch", what ),
212 field( f ) {}
213 int field;
214};
215
217struct DoNotSend : public Exception
218{
219 DoNotSend( const std::string& what = "" )
220 : Exception( "Do Not Send Message", what ) {}
221};
222
224struct RejectLogon : public Exception
225{
226 RejectLogon( const std::string& what = "" )
227 : Exception( "Rejected Logon Attempt", what ) {}
228};
229
232{
233 SessionNotFound( const std::string& what = "" )
234 : Exception( "Session Not Found", what ) {}
235};
236
238struct IOException : public Exception
239{
240 IOException( const std::string& what = "" )
241 : Exception( "IO Error", what ) {}
242};
243
246{
248 : Exception( "Socket Error", errorToWhat() ) {}
249
250 SocketException( const std::string& what )
251 : Exception( "Socket Error", what ) {}
252
253 static std::string errorToWhat()
254 {
255#ifdef _MSC_VER
256 int error = WSAGetLastError();
257 char buffer[2048];
258 FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM, NULL, error,
259 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
260 buffer, 2048, NULL );
261 return buffer;
262#else
263 int error = errno;
264 return strerror( error );
265#endif
266 }
267};
268
271{
273 SocketSendFailed( const std::string& what )
274 : SocketException( what ) {}
275};
276
279{
280 SocketRecvFailed( ssize_t size )
281 : SocketException( size == 0 ? "Connection reset by peer." : size < 0 ? errorToWhat() : "Success." ) {}
282 SocketRecvFailed( const std::string& what )
283 : SocketException( what ) {}
284};
285
288{
290 SocketCloseFailed( const std::string& what )
291 : SocketException( what ) {}
292};
293
295}
296
297#endif //FIX_EXCEPTIONS_H
Application is not configured correctly
Definition Exceptions.h:88
ConfigError(const std::string &what="")
Definition Exceptions.h:89
DataDictionary not found for BeginString or ApplVerID.
Definition Exceptions.h:47
DataDictionaryNotFound(const std::string &v, const std::string &what="")
Definition Exceptions.h:48
Indicates user does not want to send a message.
Definition Exceptions.h:218
DoNotSend(const std::string &what="")
Definition Exceptions.h:219
Field shows up twice in the message.
Definition Exceptions.h:163
DuplicateFieldNumber(const std::string &what="")
Definition Exceptions.h:164
Base QuickFIX exception type.
Definition Exceptions.h:34
std::string detail
Definition Exceptions.h:42
std::string type
Definition Exceptions.h:41
Exception(const std::string &t, const std::string &d)
Definition Exceptions.h:35
Unable to convert field into its native format.
Definition Exceptions.h:67
FieldConvertError(const std::string &what="")
Definition Exceptions.h:68
Field not found inside a message.
Definition Exceptions.h:58
FieldNotFound(int f=0, const std::string &what="")
Definition Exceptions.h:59
IOException(const std::string &what="")
Definition Exceptions.h:240
Field has a badly formatted value.
Definition Exceptions.h:147
IncorrectDataFormat(int f=0, const std::string &what="")
Definition Exceptions.h:148
Message is not structured correctly.
Definition Exceptions.h:156
IncorrectMessageStructure(const std::string &what="")
Definition Exceptions.h:157
Field has a value that is out of range.
Definition Exceptions.h:138
IncorrectTagValue(int f=0, const std::string &what="")
Definition Exceptions.h:139
Not a recognizable message.
Definition Exceptions.h:81
InvalidMessage(const std::string &what="")
Definition Exceptions.h:82
Not a known message type.
Definition Exceptions.h:170
InvalidMessageType(const std::string &what="")
Definition Exceptions.h:171
Tag number does not exist in specification.
Definition Exceptions.h:102
InvalidTagNumber(int f=0, const std::string &what="")
Definition Exceptions.h:103
Unable to parse message.
Definition Exceptions.h:74
MessageParseError(const std::string &what="")
Definition Exceptions.h:75
Field exists in message without a value.
Definition Exceptions.h:129
NoTagValue(int f=0, const std::string &what="")
Definition Exceptions.h:130
User wants to reject permission to logon.
Definition Exceptions.h:225
RejectLogon(const std::string &what="")
Definition Exceptions.h:226
Repeated tag not part of repeating group.
Definition Exceptions.h:200
RepeatedTag(int f=0, const std::string &what="")
Definition Exceptions.h:201
Repeated group count not equal to actual count.
Definition Exceptions.h:209
RepeatingGroupCountMismatch(int f=0, const std::string &what="")
Definition Exceptions.h:210
Required field is not in message.
Definition Exceptions.h:111
RequiredTagMissing(int f=0, const std::string &what="")
Definition Exceptions.h:112
Application encountered serious error during runtime
Definition Exceptions.h:95
RuntimeError(const std::string &what="")
Definition Exceptions.h:96
Session cannot be found for specified action.
Definition Exceptions.h:232
SessionNotFound(const std::string &what="")
Definition Exceptions.h:233
Socket close operation failed.
Definition Exceptions.h:288
SocketCloseFailed(const std::string &what)
Definition Exceptions.h:290
Socket Error.
Definition Exceptions.h:246
static std::string errorToWhat()
Definition Exceptions.h:253
SocketException(const std::string &what)
Definition Exceptions.h:250
Socket recv operation failed.
Definition Exceptions.h:279
SocketRecvFailed(const std::string &what)
Definition Exceptions.h:282
SocketRecvFailed(ssize_t size)
Definition Exceptions.h:280
Socket send operation failed.
Definition Exceptions.h:271
SocketSendFailed(const std::string &what)
Definition Exceptions.h:273
Field does not belong to message.
Definition Exceptions.h:120
TagNotDefinedForMessage(int f=0, const std::string &what="")
Definition Exceptions.h:121
Tag is not in the correct order.
Definition Exceptions.h:191
TagOutOfOrder(int f=0, const std::string &what="")
Definition Exceptions.h:192
Message type not supported by application.
Definition Exceptions.h:177
UnsupportedMessageType(const std::string &what="")
Definition Exceptions.h:178
Version of FIX is not supported.
Definition Exceptions.h:184
UnsupportedVersion(const std::string &what="")
Definition Exceptions.h:185

Generated on Mon Mar 4 2024 21:10:02 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001