OnixS Eurex ETI Handler C++ library  9.22.0
API documentation
Error Handling

Error Handling Concept

Being C++ class library, the Handler uses exceptions to report about error occurred while performing certain action. For example, the Handler will raise regular exception to report about inability to find actual license for the product. However, Handler processes market data asynchronously, therefore Handler is not able to report about any further errors since market data processing is started. For this reason, the Handler exposes OnixS::Eurex::Trading::ErrorListener interface and OnixS::Eurex::Trading::Handler::registerErrorListener member to be able to subscribe to and handle errors.

Once instance of OnixS::Eurex::Trading::ErrorListener is assigned to the Handler, it will invoke OnixS::Eurex::Trading::ErrorListener::onError member each time error occurs. This callback provides an OnixS::Eurex::Trading::ErrorCode value along with a human-readable description of the error.

Error Code Possible Causes
OnixS::Eurex::Trading::ErrorCode::General These errors typically occur when connections fail, such as a refused or dropped network connection, or when invalid user input is provided. They can also arise from system-related issues like hardware failures or insufficient memory.
OnixS::Eurex::Trading::ErrorCode::Protocol Signals that a corrupted or malformed message is received from exchange or communication protocol is broken.

Example

Following sample demonstrates how to receive error notifications:

using namespace OnixS::Eurex::Trading;
// ErrorListener interface can be hidden from publicity
// to make Handler 'exclusive' user of onError member.
class ErrorDumper : ErrorListener
{
public:
// Assigns itself to given handler as error listener.
ErrorDumper(Handler& handler)
{
handler.registerErrorListener(this);
}
private:
// Implements base interface to dump errors onto console.
virtual void onError(ErrorCode::Enum code, const std::string& description)
{
std::cout << "Error occurred, errorCode = " << enumToString (code) << ". Description: '" << description << "'" << std::endl;
}
};
...
Handler handler(handlerSettings);
ErrorDumper errorDumper(handler);
...