Merge lp:~charlesk/indicator-datetime/lp-1384714-silence-wakeup-warning into lp:indicator-datetime/15.04

Proposed by Charles Kerr on 2014-11-04
Status: Merged
Approved by: Ted Gould on 2014-11-04
Approved revision: 390
Merged at revision: 389
Proposed branch: lp:~charlesk/indicator-datetime/lp-1384714-silence-wakeup-warning
Merge into: lp:indicator-datetime/15.04
Diff against target: 18 lines (+6/-1)
1 file modified
src/wakeup-timer-powerd.cpp (+6/-1)
To merge this branch: bzr merge lp:~charlesk/indicator-datetime/lp-1384714-silence-wakeup-warning
Reviewer Review Type Date Requested Status
Ted Gould (community) 2014-11-04 Approve on 2014-11-04
PS Jenkins bot (community) continuous-integration Approve on 2014-11-04
Review via email: mp+240596@code.launchpad.net

Commit message

Don't log an error if powerd isn't available on the system.

Description of the change

Don't log an error if powerd isn't available on the system: we don't need it for desktop, which is where this error message is getting logged, so it's okay to fail silently.

To post a comment you must log in.
Ted Gould (ted) wrote :

I think we need a comment on why that error is being ignored in the source code.

review: Needs Fixing
390. By Charles Kerr on 2014-11-04

add a comment explaining why it's okay to let that fail silently.

Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wakeup-timer-powerd.cpp'
2--- src/wakeup-timer-powerd.cpp 2014-09-19 14:34:50 +0000
3+++ src/wakeup-timer-powerd.cpp 2014-11-04 18:27:51 +0000
4@@ -192,8 +192,13 @@
5 ret = g_dbus_connection_call_finish(G_DBUS_CONNECTION(o), res, &error);
6 if (ret == nullptr)
7 {
8- if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
9+ /* powerd isn't on the desktop, but we don't need hardware wakeups there
10+ anyway... so no need to warn on SERVICE_UNKNOWN */
11+ if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
12+ !g_error_matches(error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN))
13+ {
14 g_warning("%s Could not set hardware wakeup: %s", G_STRLOC, error->message);
15+ }
16 }
17 else
18 {

Subscribers

People subscribed via source and target branches