Skip to content

Commit

Permalink
Don't crash if ":1.41 was not provided"
Browse files Browse the repository at this point in the history
Relates to bug #1
  • Loading branch information
wdoekes committed Mar 16, 2021
1 parent 62ad031 commit 7420dff
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions openvpn-u2f-ask-password
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ try:
# "ValueError: Namespace Notify not available for version 0.8"
gi.require_version('Notify', '0.7') # hide version warning

from gi.repository import Notify as GObjectNotify
from gi.repository import Notify as GObjectNotify, GLib

# We expect python3-dbus through these dependent apt packages:
# ubuntu-server -> software-properties-common -> python3-dbus
Expand Down Expand Up @@ -149,7 +149,15 @@ class Notification:

def show(self):
if self._notification:
self._notification.show()
try:
self._notification.show()
except GLib.Error as e:
# (Observed during boot.)
# gi.repository.GLib.Error: g-dbus-error-quark:
# GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown:
# The name :1.41 was not provided by any .service files (2)
print('ERROR showing notification: {}'.format(e))

print('> [{}]\n> {}'.format(self._title, self._body))


Expand Down

0 comments on commit 7420dff

Please sign in to comment.