From 81e3056ff97c7695ff016716b181bb3e5c31ee42 Mon Sep 17 00:00:00 2001
From: RemixDev <RemixDev64@gmail.com>
Date: Wed, 6 Jan 2021 21:06:50 +0100
Subject: [PATCH] Fixed error logging

---
 deemix/app/queuemanager.py | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/deemix/app/queuemanager.py b/deemix/app/queuemanager.py
index 45d3b61..4547bf8 100644
--- a/deemix/app/queuemanager.py
+++ b/deemix/app/queuemanager.py
@@ -30,8 +30,8 @@ class QueueManager:
             try:
                 trackAPI = dz.api.get_track(id)
             except APIError as e:
-                e = json.loads(str(e))
-                return QueueError("https://deezer.com/track/"+str(id), f"Wrong URL: {e['type']+': ' if 'type' in e else ''}{e['message'] if 'message' in e else ''}")
+                e = str(e)
+                return QueueError("https://deezer.com/track/"+str(id), f"Wrong URL: {e}")
             if 'id' in trackAPI and 'title' in trackAPI:
                 id = trackAPI['id']
             else:
@@ -41,7 +41,7 @@ class QueueManager:
         try:
             trackAPI_gw = dz.gw.get_track_with_fallback(id)
         except gwAPIError as e:
-            e = json.loads(str(e))
+            e = str(e)
             message = "Wrong URL"
             if "DATA_ERROR" in e: message += f": {e['DATA_ERROR']}"
             return QueueError("https://deezer.com/track/"+str(id), message)
@@ -78,8 +78,8 @@ class QueueManager:
         try:
             albumAPI = dz.api.get_album(id)
         except APIError as e:
-            e = json.loads(str(e))
-            return QueueError("https://deezer.com/album/"+str(id), f"Wrong URL: {e['type']+': ' if 'type' in e else ''}{e['message'] if 'message' in e else ''}")
+            e = str(e)
+            return QueueError("https://deezer.com/album/"+str(id), f"Wrong URL: {e}")
 
         if str(id).startswith('upc'): id = albumAPI['id']
 
@@ -138,7 +138,7 @@ class QueueManager:
                 userPlaylist = dz.gw.get_playlist_page(id)
                 playlistAPI = map_user_playlist(userPlaylist['DATA'])
             except gwAPIError as e:
-                e = json.loads(str(e))
+                e = str(e)
                 message = "Wrong URL"
                 if "DATA_ERROR" in e:
                     message += f": {e['DATA_ERROR']}"
@@ -184,8 +184,8 @@ class QueueManager:
         try:
             artistAPI = dz.api.get_artist(id)
         except APIError as e:
-            e = json.loads(str(e))
-            return QueueError("https://deezer.com/artist/"+str(id), f"Wrong URL: {e['type']+': ' if 'type' in e else ''}{e['message'] if 'message' in e else ''}")
+            e = str(e)
+            return QueueError("https://deezer.com/artist/"+str(id), f"Wrong URL: {e}")
 
         if interface: interface.send("startAddingArtist", {'name': artistAPI['name'], 'id': artistAPI['id']})
         rootArtist = {
@@ -207,8 +207,8 @@ class QueueManager:
         try:
             artistAPI = dz.api.get_artist(id)
         except APIError as e:
-            e = json.loads(str(e))
-            return QueueError("https://deezer.com/artist/"+str(id)+"/discography", f"Wrong URL: {e['type']+': ' if 'type' in e else ''}{e['message'] if 'message' in e else ''}")
+            e = str(e)
+            return QueueError("https://deezer.com/artist/"+str(id)+"/discography", f"Wrong URL: {e}")
 
         if interface: interface.send("startAddingArtist", {'name': artistAPI['name'], 'id': artistAPI['id']})
         rootArtist = {
@@ -231,8 +231,8 @@ class QueueManager:
         try:
             artistAPI = dz.api.get_artist(id)
         except APIError as e:
-            e = json.loads(str(e))
-            return QueueError("https://deezer.com/artist/"+str(id)+"/top_track", f"Wrong URL: {e['type']+': ' if 'type' in e else ''}{e['message'] if 'message' in e else ''}")
+            e = str(e)
+            return QueueError("https://deezer.com/artist/"+str(id)+"/top_track", f"Wrong URL: {e}")
 
         # Emulate the creation of a playlist
         # Can't use generatePlaylistQueueItem as this is not a real playlist