From 94dbe30902e36cedb30cb89ea3bd7ecd6c5a03f2 Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Tue, 16 Jun 2020 23:01:16 +0200 Subject: Adds improved error handling. --- src/protocolhandler.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/protocolhandler.hpp') diff --git a/src/protocolhandler.hpp b/src/protocolhandler.hpp index f4ae9eb..f93ef87 100644 --- a/src/protocolhandler.hpp +++ b/src/protocolhandler.hpp @@ -1,10 +1,11 @@ #ifndef GENERICPROTOCOLCLIENT_HPP #define GENERICPROTOCOLCLIENT_HPP -#include - #include "cryptoidentity.hpp" +#include +#include + class ProtocolHandler : public QObject { Q_OBJECT @@ -12,7 +13,8 @@ public: enum NetworkError { UnknownError, //!< There was an unhandled network error ProtocolViolation, //!< The server responded with something unexpected and violated the protocol - HostNotFound, //!< The host + HostNotFound, //!< The host was not found by the client + ConnectionRefused, //!< The host refused connection on that port ResourceNotFound, //!< The requested resource was not found on the server BadRequest, //!< Our client misbehaved and did a request the server cannot understand ProxyRequest, //!< We requested to @@ -22,6 +24,7 @@ public: MistrustedHost, //!< We know the host and it's not the server identity we've seen before Unauthorized, //!< The requested resource could not be accessed. TlsFailure, //!< Unspecified TLS failure + Timeout, //!< The network connection timed out. }; public: explicit ProtocolHandler(QObject *parent = nullptr); @@ -54,6 +57,8 @@ signals: //! The server wants us to use a client certificate void certificateRequired(QString const & info); +protected: + void emitNetworkError(QAbstractSocket::SocketError error_code, QString const & textual_description); }; #endif // GENERICPROTOCOLCLIENT_HPP -- cgit v1.2.3