diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-20 14:59:59 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-20 14:59:59 +0200 |
commit | ac73ca1d2a23d3b62cca20545e019355f9d00035 (patch) | |
tree | f2db2cf9e1bc5b5026a0592df63eaacf68a7d0d8 | |
parent | 766f40bed69c053c22ae28cfb4115e717c44b616 (diff) | |
download | sink-ac73ca1d2a23d3b62cca20545e019355f9d00035.tar.gz sink-ac73ca1d2a23d3b62cca20545e019355f9d00035.zip |
Handle host not found
-rw-r--r-- | examples/imapresource/imapserverproxy.cpp | 10 | ||||
-rw-r--r-- | examples/imapresource/imapserverproxy.h | 1 |
2 files changed, 8 insertions, 3 deletions
diff --git a/examples/imapresource/imapserverproxy.cpp b/examples/imapresource/imapserverproxy.cpp index 0cc43b8..3305f60 100644 --- a/examples/imapresource/imapserverproxy.cpp +++ b/examples/imapresource/imapserverproxy.cpp | |||
@@ -161,12 +161,16 @@ KAsync::Job<void> ImapServerProxy::login(const QString &username, const QString | |||
161 | // SinkTrace() << "Found user namespaces: " << mNamespaces.user; | 161 | // SinkTrace() << "Found user namespaces: " << mNamespaces.user; |
162 | }).then([=] (const KAsync::Error &error) { | 162 | }).then([=] (const KAsync::Error &error) { |
163 | if (error) { | 163 | if (error) { |
164 | if (error.errorCode == KIMAP2::LoginJob::ErrorCode::ERR_COULD_NOT_CONNECT) { | 164 | switch (error.errorCode) { |
165 | case KIMAP2::LoginJob::ErrorCode::ERR_HOST_NOT_FOUND: | ||
166 | return KAsync::error(HostNotFoundError, "Host not found: " + error.errorMessage); | ||
167 | case KIMAP2::LoginJob::ErrorCode::ERR_COULD_NOT_CONNECT: | ||
165 | return KAsync::error(CouldNotConnectError, "Failed to connect: " + error.errorMessage); | 168 | return KAsync::error(CouldNotConnectError, "Failed to connect: " + error.errorMessage); |
166 | } else if (error.errorCode == KIMAP2::LoginJob::ErrorCode::ERR_SSL_HANDSHAKE_FAILED) { | 169 | case KIMAP2::LoginJob::ErrorCode::ERR_SSL_HANDSHAKE_FAILED: |
167 | return KAsync::error(SslHandshakeError, "Ssl handshake failed: " + error.errorMessage); | 170 | return KAsync::error(SslHandshakeError, "Ssl handshake failed: " + error.errorMessage); |
171 | default: | ||
172 | return KAsync::error(error); | ||
168 | } | 173 | } |
169 | return KAsync::error(error); | ||
170 | } | 174 | } |
171 | return KAsync::null(); | 175 | return KAsync::null(); |
172 | }); | 176 | }); |
diff --git a/examples/imapresource/imapserverproxy.h b/examples/imapresource/imapserverproxy.h index 872f032..58c49a2 100644 --- a/examples/imapresource/imapserverproxy.h +++ b/examples/imapresource/imapserverproxy.h | |||
@@ -31,6 +31,7 @@ namespace Imap { | |||
31 | 31 | ||
32 | enum ErrorCode { | 32 | enum ErrorCode { |
33 | NoError, | 33 | NoError, |
34 | HostNotFoundError, | ||
34 | CouldNotConnectError, | 35 | CouldNotConnectError, |
35 | SslHandshakeError | 36 | SslHandshakeError |
36 | }; | 37 | }; |