[gnome-music/wip/jfelder/38-playlist-title-quotation: 1/3] grltrackerplaylists: Check for failure on playlist creation




commit 9433c2b0b5ec3849e0252663612056aebd66c6fe
Author: Jean Felder <jfelder src gnome org>
Date:   Wed Feb 24 19:55:39 2021 +0100

    grltrackerplaylists: Check for failure on playlist creation
    
    This prevents a crash if a playlist cannot be created.
    
    Related: https://gitlab.gnome.org/GNOME/gnome-music/-/issues/447

 gnomemusic/grilowrappers/grltrackerplaylists.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerplaylists.py b/gnomemusic/grilowrappers/grltrackerplaylists.py
index 566a67621..fa1238d23 100644
--- a/gnomemusic/grilowrappers/grltrackerplaylists.py
+++ b/gnomemusic/grilowrappers/grltrackerplaylists.py
@@ -200,7 +200,18 @@ class GrlTrackerPlaylists(GObject.GObject):
         :param callback: function to perform once, the playlist is created
         """
         def _create_cb(conn, res, data):
-            result = conn.update_blank_finish(res)
+            try:
+                result = conn.update_blank_finish(res)
+            except GLib.Error as error:
+                self._log.warning(
+                    "Unable to create playlist {}: {}".format(
+                        playlist_title, error.message))
+                self._notificationmanager.pop_loading()
+                if callback is not None:
+                    callback(None)
+
+                return
+
             playlist_urn = result[0][0]['playlist']
             query = """
             SELECT


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]