Merge lp:~michihenning/storage-framework/add-trace into lp:storage-framework/devel

Proposed by Michi Henning
Status: Merged
Approved by: James Henstridge
Approved revision: 56
Merged at revision: 54
Proposed branch: lp:~michihenning/storage-framework/add-trace
Merge into: lp:storage-framework/devel
Diff against target: 361 lines (+197/-10)
10 files modified
CMakeLists.txt (+1/-0)
include/unity/storage/internal/TraceMessageHandler.h (+46/-0)
include/unity/storage/provider/internal/ServerImpl.h (+2/-0)
include/unity/storage/qt/client/internal/remote_client/Handler.h (+16/-1)
src/internal/CMakeLists.txt (+1/-0)
src/internal/TraceMessageHandler.cpp (+96/-0)
src/provider/internal/Handler.cpp (+29/-5)
src/provider/internal/ServerImpl.cpp (+4/-1)
src/qt/client/internal/remote_client/RuntimeImpl.cpp (+0/-1)
tests/provider-ProviderInterface/ProviderInterface_test.cpp (+2/-2)
To merge this branch: bzr merge lp:~michihenning/storage-framework/add-trace
Reviewer Review Type Date Requested Status
James Henstridge Approve
unity-api-1-bot continuous-integration Approve
Review via email: mp+302767@code.launchpad.net

Commit message

Added trace for surprising exceptions to server side and remote client.

Description of the change

Added trace for surprising exceptions to server side and remote client.

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:55
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/76/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/374/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/380
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=vivid+overlay/297
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=xenial+overlay/297
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=yakkety/297
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/227
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/227/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/227
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/227/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/227
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/227/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/227
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/227/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/227
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/227/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/227
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/227/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/227
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/227/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/227
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/227/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/227/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/76/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:55
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/77/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/375
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/381
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=vivid+overlay/298
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=xenial+overlay/298
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=yakkety/298
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/228
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/228/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/228
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/228/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/228
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/228/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/228
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/228/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/228
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/228/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/228
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/228/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/228
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/228/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/228
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/228/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/228
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/228/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/77/rebuild

review: Approve (continuous-integration)
56. By Michi Henning

Logging surprising exceptions with qCritical() now.

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:56
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/78/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/389/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/395
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=vivid+overlay/310
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=xenial+overlay/310
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=yakkety/310
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/240
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/240/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/240
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/240/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/240/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/240
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/240/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/240
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/240/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/240
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/240/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/240
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/240/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/240
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/240/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/240
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/240/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/78/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:56
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/79/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/390
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/396
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=vivid+overlay/311
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=xenial+overlay/311
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-1-sourcepkg/release=yakkety/311
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/241
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/241/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/241
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/241/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/241
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/241/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/241
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/241/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/241
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/241/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/241
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/241/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/241
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/241/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/241
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/241/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/241
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/241/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-storage-framework-ci/79/rebuild

review: Approve (continuous-integration)
Revision history for this message
James Henstridge (jamesh) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-08-11 02:03:32 +0000
+++ CMakeLists.txt 2016-08-17 02:55:56 +0000
@@ -130,6 +130,7 @@
130enable_coverage_report(130enable_coverage_report(
131 TARGETS131 TARGETS
132 qt-client-lib-common132 qt-client-lib-common
133 storage-framework-common-internal
133 storage-framework-qt-client134 storage-framework-qt-client
134 storage-framework-qt-local-client135 storage-framework-qt-local-client
135 sf-provider-objects136 sf-provider-objects
136137
=== added file 'include/unity/storage/internal/TraceMessageHandler.h'
--- include/unity/storage/internal/TraceMessageHandler.h 1970-01-01 00:00:00 +0000
+++ include/unity/storage/internal/TraceMessageHandler.h 2016-08-17 02:55:56 +0000
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2015 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors: Michi Henning <michi.henning@canonical.com>
17 */
18
19#pragma once
20
21#pragma GCC diagnostic push
22#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
23#pragma GCC diagnostic ignored "-Wswitch-default"
24#include <QDebug>
25#pragma GCC diagnostic pop
26
27namespace unity
28{
29namespace storage
30{
31namespace internal
32{
33
34class TraceMessageHandler final
35{
36public:
37 TraceMessageHandler(std::string const& prog_name);
38 ~TraceMessageHandler();
39
40private:
41 QtMessageHandler old_message_handler_;
42};
43
44} // namespace internal
45} // namespace storage
46} // namespace unity
047
=== modified file 'include/unity/storage/provider/internal/ServerImpl.h'
--- include/unity/storage/provider/internal/ServerImpl.h 2016-07-12 02:22:05 +0000
+++ include/unity/storage/provider/internal/ServerImpl.h 2016-08-17 02:55:56 +0000
@@ -19,6 +19,7 @@
19#pragma once19#pragma once
2020
21#include <unity/storage/provider/Server.h>21#include <unity/storage/provider/Server.h>
22#include <unity/storage/internal/TraceMessageHandler.h>
22#include <unity/storage/provider/internal/DBusPeerCache.h>23#include <unity/storage/provider/internal/DBusPeerCache.h>
23#include <unity/storage/provider/internal/ProviderInterface.h>24#include <unity/storage/provider/internal/ProviderInterface.h>
2425
@@ -58,6 +59,7 @@
58 ServerBase* const server_;59 ServerBase* const server_;
59 std::string const bus_name_;60 std::string const bus_name_;
60 std::string const service_id_;61 std::string const service_id_;
62 unity::storage::internal::TraceMessageHandler trace_message_handler_;
6163
62 std::unique_ptr<QCoreApplication> app_;64 std::unique_ptr<QCoreApplication> app_;
63 std::unique_ptr<OnlineAccounts::Manager> manager_;65 std::unique_ptr<OnlineAccounts::Manager> manager_;
6466
=== modified file 'include/unity/storage/qt/client/internal/remote_client/Handler.h'
--- include/unity/storage/qt/client/internal/remote_client/Handler.h 2016-08-11 01:39:44 +0000
+++ include/unity/storage/qt/client/internal/remote_client/Handler.h 2016-08-17 02:55:56 +0000
@@ -80,10 +80,25 @@
80 auto ep = unmarshal_exception(call);80 auto ep = unmarshal_exception(call);
81 std::rethrow_exception(ep);81 std::rethrow_exception(ep);
82 }82 }
83 // We catch some exceptions that are "surprising" so we can log those.
84 catch (LocalCommsException const& e)
85 {
86 qCritical() << "provider exception:" << e.what();
87 make_exceptional_future<T>(qf_, e);
88 }
89 catch (RemoteCommsException const& e)
90 {
91 qCritical() << "provider exception:" << e.what();
92 make_exceptional_future<T>(qf_, e);
93 }
94 catch (ResourceException const& e)
95 {
96 qCritical() << "provider exception:" << e.what();
97 make_exceptional_future<T>(qf_, e);
98 }
83 catch (StorageException const& e)99 catch (StorageException const& e)
84 {100 {
85 make_exceptional_future<T>(qf_, e);101 make_exceptional_future<T>(qf_, e);
86 return;
87 }102 }
88 // LCOV_EXCL_START103 // LCOV_EXCL_START
89 catch (...)104 catch (...)
90105
=== modified file 'src/internal/CMakeLists.txt'
--- src/internal/CMakeLists.txt 2016-08-11 06:53:25 +0000
+++ src/internal/CMakeLists.txt 2016-08-17 02:55:56 +0000
@@ -1,6 +1,7 @@
1set(src1set(src
2 dbusmarshal.cpp2 dbusmarshal.cpp
3 safe_strerror.cpp3 safe_strerror.cpp
4 TraceMessageHandler.cpp
4)5)
56
6add_library(storage-framework-common-internal STATIC ${src})7add_library(storage-framework-common-internal STATIC ${src})
78
=== added file 'src/internal/TraceMessageHandler.cpp'
--- src/internal/TraceMessageHandler.cpp 1970-01-01 00:00:00 +0000
+++ src/internal/TraceMessageHandler.cpp 2016-08-17 02:55:56 +0000
@@ -0,0 +1,96 @@
1/*
2 * Copyright (C) 2015 Canonical Ltd
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors: Michi Henning <michi.henning@canonical.com>
17 */
18
19#include <unity/storage/internal/TraceMessageHandler.h>
20
21#include <chrono>
22#include <mutex>
23
24using namespace std;
25
26namespace unity
27{
28namespace storage
29{
30namespace internal
31{
32namespace
33{
34
35string prefix;
36
37void trace_message_handler(QtMsgType type, const QMessageLogContext& /*context*/, const QString& msg)
38{
39 using namespace std;
40 using namespace std::chrono;
41
42 static recursive_mutex mutex;
43 lock_guard<decltype(mutex)> lock(mutex);
44
45 auto now = system_clock::now();
46 auto sys_time = system_clock::to_time_t(now);
47 struct tm local_time;
48 localtime_r(&sys_time, &local_time);
49 int msecs = duration_cast<milliseconds>(now.time_since_epoch()).count() % 1000;
50
51 if (!prefix.empty())
52 {
53 fprintf(stderr, "%s: ", prefix.c_str());
54 }
55 char buf[100];
56 strftime(buf, sizeof(buf), "%T", &local_time);
57 fprintf(stderr, "[%s.%03d]", buf, msecs);
58 switch (type)
59 {
60 case QtWarningMsg:
61 fputs(" Warning:", stderr);
62 break;
63 case QtCriticalMsg:
64 fputs(" Critical:", stderr);
65 break;
66 // LCOV_EXCL_START
67 case QtFatalMsg:
68 fputs(" Fatal:", stderr);
69 break;
70 // LCOV_EXCL_STOP
71 default:
72 break; // No label for debug messages.
73 }
74 fprintf(stderr, " %s\n", msg.toLocal8Bit().constData());
75 if (type == QtFatalMsg)
76 {
77 abort(); // LCOV_EXCL_LINE
78 }
79}
80
81} // namespace
82
83TraceMessageHandler::TraceMessageHandler(string const& prog_name)
84{
85 prefix = prog_name;
86 old_message_handler_ = qInstallMessageHandler(trace_message_handler);
87}
88
89TraceMessageHandler::~TraceMessageHandler()
90{
91 qInstallMessageHandler(old_message_handler_);
92}
93
94} // namespace internal
95} // namespace storage
96} // namespace unity
097
=== modified file 'src/provider/internal/Handler.cpp'
--- src/provider/internal/Handler.cpp 2016-08-11 01:39:44 +0000
+++ src/provider/internal/Handler.cpp 2016-08-17 02:55:56 +0000
@@ -26,6 +26,12 @@
26#include <unity/storage/provider/ProviderBase.h>26#include <unity/storage/provider/ProviderBase.h>
27#include <unity/storage/provider/Exceptions.h>27#include <unity/storage/provider/Exceptions.h>
2828
29#pragma GCC diagnostic push
30#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
31#pragma GCC diagnostic ignored "-Wswitch-default"
32#include <QDebug>
33#pragma GCC diagnostic pop
34
29#include <stdexcept>35#include <stdexcept>
3036
31using namespace unity::storage::internal;37using namespace unity::storage::internal;
@@ -65,7 +71,9 @@
65 }71 }
66 else72 else
67 {73 {
68 auto ep = make_exception_ptr(PermissionException("Handler::begin(): could not retrieve credentials"));74 string msg = "Handler::begin(): could not retrieve credentials";
75 qDebug() << QString::fromStdString(msg);
76 auto ep = make_exception_ptr(PermissionException(msg));
69 marshal_exception(ep);77 marshal_exception(ep);
70 QMetaObject::invokeMethod(this, "send_reply",78 QMetaObject::invokeMethod(this, "send_reply",
71 Qt::QueuedConnection);79 Qt::QueuedConnection);
@@ -82,6 +90,7 @@
82 }90 }
83 catch (std::exception const& e)91 catch (std::exception const& e)
84 {92 {
93 qDebug() << "provider method threw an exception:" << e.what();
85 marshal_exception(current_exception());94 marshal_exception(current_exception());
86 QMetaObject::invokeMethod(this, "send_reply", Qt::QueuedConnection);95 QMetaObject::invokeMethod(this, "send_reply", Qt::QueuedConnection);
87 return;96 return;
@@ -94,8 +103,9 @@
94 {103 {
95 reply_ = f.get();104 reply_ = f.get();
96 }105 }
97 catch (std::exception const&)106 catch (std::exception const& e)
98 {107 {
108 qDebug() << e.what();
99 marshal_exception(current_exception());109 marshal_exception(current_exception());
100 }110 }
101 QMetaObject::invokeMethod(this, "send_reply", Qt::QueuedConnection);111 QMetaObject::invokeMethod(this, "send_reply", Qt::QueuedConnection);
@@ -133,20 +143,34 @@
133 }143 }
134 catch (ResourceException const& e)144 catch (ResourceException const& e)
135 {145 {
146 qDebug() << e.what();
136 reply_ << QVariant(e.error_code());147 reply_ << QVariant(e.error_code());
137 }148 }
149 catch (RemoteCommsException const& e)
150 {
151 qDebug() << e.what();
152 }
153 catch (UnknownException const& e)
154 {
155 qDebug() << e.what();
156 }
138 catch (StorageException const&)157 catch (StorageException const&)
139 {158 {
140 // Some other sub-type of StorageException without additional data members.159 // Some other sub-type of StorageException without additional data members,
160 // and we don't want to log this (not surprising) exception.
141 }161 }
142 }162 }
143 catch (std::exception const& e)163 catch (std::exception const& e)
144 {164 {
145 reply_ = message_.createErrorReply(QString(DBUS_ERROR_PREFIX) + "UnknownException", e.what());165 QString msg = QString("unknown exception thrown by provider: ") + e.what();
166 qDebug() << msg;
167 reply_ = message_.createErrorReply(QString(DBUS_ERROR_PREFIX) + "UnknownException", msg);
146 }168 }
147 catch (...)169 catch (...)
148 {170 {
149 reply_ = message_.createErrorReply(QString(DBUS_ERROR_PREFIX) + "UnknownException", "unknown exception type");171 QString msg = "unknown exception thrown by provider";
172 qDebug() << msg;
173 reply_ = message_.createErrorReply(QString(DBUS_ERROR_PREFIX) + "UnknownException", msg);
150 }174 }
151}175}
152176
153177
=== modified file 'src/provider/internal/ServerImpl.cpp'
--- src/provider/internal/ServerImpl.cpp 2016-08-12 01:34:34 +0000
+++ src/provider/internal/ServerImpl.cpp 2016-08-17 02:55:56 +0000
@@ -38,7 +38,10 @@
38{38{
3939
40ServerImpl::ServerImpl(ServerBase* server, string const& bus_name, string const& account_service_id)40ServerImpl::ServerImpl(ServerBase* server, string const& bus_name, string const& account_service_id)
41 : server_(server), bus_name_(bus_name), service_id_(account_service_id)41 : server_(server)
42 , bus_name_(bus_name)
43 , service_id_(account_service_id)
44 , trace_message_handler_("storage_provider")
42{45{
43 qDBusRegisterMetaType<Item>();46 qDBusRegisterMetaType<Item>();
44 qDBusRegisterMetaType<std::vector<Item>>();47 qDBusRegisterMetaType<std::vector<Item>>();
4548
=== modified file 'src/qt/client/internal/remote_client/RuntimeImpl.cpp'
--- src/qt/client/internal/remote_client/RuntimeImpl.cpp 2016-08-12 00:01:19 +0000
+++ src/qt/client/internal/remote_client/RuntimeImpl.cpp 2016-08-17 02:55:56 +0000
@@ -139,7 +139,6 @@
139 {139 {
140 for (auto const& a : manager_->availableAccounts(service_id))140 for (auto const& a : manager_->availableAccounts(service_id))
141 {141 {
142 qDebug() << "got account:" << a->displayName() << a->serviceId() << a->id();
143 auto object_path = QStringLiteral("/provider/%1").arg(a->id());142 auto object_path = QStringLiteral("/provider/%1").arg(a->id());
144 accounts.append(make_account(BUS_NAME, object_path,143 accounts.append(make_account(BUS_NAME, object_path,
145 "", a->serviceId(), a->displayName()));144 "", a->serviceId(), a->displayName()));
146145
=== modified file 'tests/provider-ProviderInterface/ProviderInterface_test.cpp'
--- tests/provider-ProviderInterface/ProviderInterface_test.cpp 2016-08-12 01:34:34 +0000
+++ tests/provider-ProviderInterface/ProviderInterface_test.cpp 2016-08-17 02:55:56 +0000
@@ -398,7 +398,7 @@
398 wait_for(reply);398 wait_for(reply);
399 ASSERT_TRUE(reply.isError());399 ASSERT_TRUE(reply.isError());
400 EXPECT_EQ(PROVIDER_ERROR + "UnknownException", reply.error().name());400 EXPECT_EQ(PROVIDER_ERROR + "UnknownException", reply.error().name());
401 EXPECT_EQ("map::at", reply.error().message());401 EXPECT_EQ("unknown exception thrown by provider: map::at", reply.error().message());
402}402}
403403
404TEST_F(ProviderInterfaceTest, download)404TEST_F(ProviderInterfaceTest, download)
@@ -472,7 +472,7 @@
472 wait_for(reply);472 wait_for(reply);
473 ASSERT_TRUE(reply.isError());473 ASSERT_TRUE(reply.isError());
474 EXPECT_EQ(PROVIDER_ERROR + "UnknownException", reply.error().name());474 EXPECT_EQ(PROVIDER_ERROR + "UnknownException", reply.error().name());
475 EXPECT_EQ("map::at", reply.error().message());475 EXPECT_EQ("unknown exception thrown by provider: map::at", reply.error().message());
476}476}
477477
478TEST_F(ProviderInterfaceTest, delete_)478TEST_F(ProviderInterfaceTest, delete_)

Subscribers

People subscribed via source and target branches

to all changes: