OnixS C++ FIX Engine  4.12.0
API Documentation
Exception.h
Go to the documentation of this file.
1 #pragma once
2 /*
3 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
4 *
5 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
6 * and international copyright treaties.
7 *
8 * Access to and use of the software is governed by the terms of the applicable OnixS Software
9 * Services Agreement (the Agreement) and Customer end user license agreements granting
10 * a non-assignable, non-transferable and non-exclusive license to use the software
11 * for it's own data processing purposes under the terms defined in the Agreement.
12 *
13 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
14 * of this source code or associated reference material to any other location for further reproduction
15 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
16 *
17 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
18 * the terms of the Agreement is a violation of copyright law.
19 */
20 
21 #include <exception>
22 
23 #include <OnixS/FIXEngine/ABI.h>
27 
28 namespace OnixS {
29 namespace FIX {
30 /// The Engine-level exception.
31 typedef std::exception Exception;
32 
33 /// The Engine-level runtime error;
34 typedef std::runtime_error RuntimeError;
35 
36 /// The first received message is not a Logon (MsgType=A) FIX Message.
38 {
39 public:
40  /// The constructor.
41  FirstMessageNotLogonException(const std::string & message, const Message & incomingMessage)
42  : RuntimeError(message)
43  , incomingMessage_(incomingMessage)
44  {}
45 
46  /// The constructor.
47  FirstMessageNotLogonException(const std::string & message, const FlatMessage & incomingMessage)
48  : RuntimeError(message)
49  , flatIncomingMessage_(incomingMessage)
50  {}
51 
52  /// The destructor.
54 
55  /// Returns the received message.
56  const Message & message() const {
57  return incomingMessage_;
58  }
59 
60  /// Returns the received message.
61  const FlatMessage & flatMessage() const {
62  return flatIncomingMessage_;
63  }
64 
65 private:
66  Message incomingMessage_;
67  FlatMessage flatIncomingMessage_;
68 };
69 
70 /// The telecommunication link error is detected after sending the initial Logon message.
72 {
73 public:
74  /// The constructor.
75  LinkErrorException(const std::string & message)
76  : RuntimeError(message)
77  {}
78 
79  /// The destructor.
81 };
82 
83 /// The first received message is a Logon message with the wrong sequence number.
85 {
86 public:
87  /// The constructor.
88  UnexpectedSequenceNumberException(const std::string & message)
89  : RuntimeError(message)
90  {}
91 
92  /// The destructor.
94 };
95 
96 /// The Timeout is occurred after sending the initial Logon message.
98 {
99 public:
100  /// The constructor.
101  TimeoutException(const std::string & message)
102  : RuntimeError(message)
103  {}
104 
105  /// The destructor.
107 };
108 
109 /// The first received message is an invalid Logon message.
111 {
112 public:
113  /// The constructor.
114  ConfirmationLogonMessageErrorException(const std::string & message)
115  : RuntimeError(message)
116  {}
117 
118  /// The destructor.
120 };
121 
122 /// The message validation is failed.
124 {
125 public:
126  /// The constructor.
127  ValidationException(const std::string & message, Tag tag, MessageValidationFlag::Enum failedValidation)
128  : RuntimeError(message), tag_(tag), failedValidation_(failedValidation)
129  {}
130 
131  /// The destructor.
133 
134  /// Returns the tag number of the invalid field.
135  Tag tag() const {
136  return tag_;
137  }
138 
139  /// Returns the validation criteria that fails.
141  return failedValidation_;
142  }
143 
144 private:
145 
146  Tag tag_;
147  MessageValidationFlag::Enum failedValidation_;
148 };
149 
150 /// An issue is occurred during the connect process.
152 {
153 public:
154  /// The constructor.
155  ConnectException(const std::string & message, int errCode = 0)
156  :RuntimeError(message), errCode_(errCode)
157  {}
158 
159  /// The destructor.
161 
162  /// Return the system-depended error code value.
163  int errorCode() const {
164  return errCode_;
165  }
166 
167 private:
168 
169  int errCode_;
170 };
171 
172 }
173 }
Tag tag() const
Returns the tag number of the invalid field.
Definition: Exception.h:135
The Timeout is occurred after sending the initial Logon message.
Definition: Exception.h:97
const Message & message() const
Returns the received message.
Definition: Exception.h:56
#define ONIXS_FIXENGINE_NOTHROW
Definition: Compiler.h:43
ConnectException(const std::string &message, int errCode=0)
The constructor.
Definition: Exception.h:155
#define ONIXS_FIXENGINE_DEFAULT
Definition: Compiler.h:176
#define ONIXS_FIXENGINE_THROWABLE_API
Definition: ABI.h:46
The message validation is failed.
Definition: Exception.h:123
std::exception Exception
The Engine-level exception.
Definition: Exception.h:31
Provides an access to FIX fields from a flat (tag=value) message.
Definition: FlatMessage.h:109
LinkErrorException(const std::string &message)
The constructor.
Definition: Exception.h:75
The first received message is not a Logon (MsgType=A) FIX Message.
Definition: Exception.h:37
UnexpectedSequenceNumberException(const std::string &message)
The constructor.
Definition: Exception.h:88
std::runtime_error RuntimeError
The Engine-level runtime error;.
Definition: Exception.h:34
An issue is occurred during the connect process.
Definition: Exception.h:151
The first received message is an invalid Logon message.
Definition: Exception.h:110
unsigned Tag
Alias for tag numbers.
Definition: Tag.h:28
int errorCode() const
Return the system-depended error code value.
Definition: Exception.h:163
const FlatMessage & flatMessage() const
Returns the received message.
Definition: Exception.h:61
TimeoutException(const std::string &message)
The constructor.
Definition: Exception.h:101
ValidationException(const std::string &message, Tag tag, MessageValidationFlag::Enum failedValidation)
The constructor.
Definition: Exception.h:127
ConfirmationLogonMessageErrorException(const std::string &message)
The constructor.
Definition: Exception.h:114
MessageValidationFlag::Enum failedValidation() const
Returns the validation criteria that fails.
Definition: Exception.h:140
Encapsulates operations over a FIX Message.
Definition: Message.h:49
The telecommunication link error is detected after sending the initial Logon message.
Definition: Exception.h:71
FirstMessageNotLogonException(const std::string &message, const FlatMessage &incomingMessage)
The constructor.
Definition: Exception.h:47
The first received message is a Logon message with the wrong sequence number.
Definition: Exception.h:84
FirstMessageNotLogonException(const std::string &message, const Message &incomingMessage)
The constructor.
Definition: Exception.h:41