From f99a8084b875815dc18ae67eeaed3919e8249463 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 27 Mar 2017 09:38:28 +0200 Subject: Don't use 0 as error code and better error codes --- common/domain/applicationdomaintype.h | 1 + examples/imapresource/imapresource.cpp | 2 +- examples/imapresource/imapserverproxy.cpp | 4 ++-- examples/imapresource/imapserverproxy.h | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index 6fd2b90..aa6a192 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h @@ -97,6 +97,7 @@ enum SINK_EXPORT ErrorCode { NoError = 0, UnknownError, NoServerError, + ConnectionError, LoginError, TransmissionError, }; diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index 5dce875..077795a 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp @@ -473,7 +473,7 @@ public: { if (error) { if (error.errorCode == Imap::CouldNotConnectError) { - return {ApplicationDomain::LoginError, error.errorMessage}; + return {ApplicationDomain::ConnectionError, error.errorMessage}; } else if (error.errorCode == Imap::SslHandshakeError) { return {ApplicationDomain::LoginError, error.errorMessage}; } diff --git a/examples/imapresource/imapserverproxy.cpp b/examples/imapresource/imapserverproxy.cpp index a856576..0cc43b8 100644 --- a/examples/imapresource/imapserverproxy.cpp +++ b/examples/imapresource/imapserverproxy.cpp @@ -69,7 +69,7 @@ static KAsync::Job runJob(KJob *job, const std::function &f) QObject::connect(job, &KJob::result, [&future, f](KJob *job) { SinkTrace() << "Job done: " << job->metaObject()->className(); if (job->error()) { - SinkWarning() << "Job failed: " << job->errorString(); + SinkWarning() << "Job failed: " << job->errorString() << job->metaObject()->className(); future.setError(job->error(), job->errorString()); } else { future.setValue(f(job)); @@ -87,7 +87,7 @@ static KAsync::Job runJob(KJob *job) QObject::connect(job, &KJob::result, [&future](KJob *job) { SinkTrace() << "Job done: " << job->metaObject()->className(); if (job->error()) { - SinkWarning() << "Job failed: " << job->errorString(); + SinkWarning() << "Job failed: " << job->errorString() << job->metaObject()->className(); future.setError(job->error(), job->errorString()); } else { future.setFinished(); diff --git a/examples/imapresource/imapserverproxy.h b/examples/imapresource/imapserverproxy.h index cae3105..872f032 100644 --- a/examples/imapresource/imapserverproxy.h +++ b/examples/imapresource/imapserverproxy.h @@ -30,6 +30,7 @@ namespace Imap { enum ErrorCode { + NoError, CouldNotConnectError, SslHandshakeError }; -- cgit v1.2.3