Skip to content

Commit 6314235

Browse files
committed
Switched to throwing an exception if the connection cannot be established.
1 parent 900f15b commit 6314235

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

myjdapi/myjdapi.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,9 @@ def action(self, path, params=(), http_action="POST"):
745745
response = self.myjd.request_api(path, http_action, params,
746746
action_url)
747747
if response is None:
748-
# My.JDownloader Api failed too.
749-
return False
748+
# My.JDownloader Api failed too we assume a problem with the connection or the api server
749+
# and throw an connection exception.
750+
raise (MYJDConnectionException("No connection established\n"))
750751
else:
751752
# My.JDownloader Api worked, lets refresh the direct connections and return
752753
# the response.
@@ -781,8 +782,9 @@ def action(self, path, params=(), http_action="POST"):
781782
response = self.myjd.request_api(path, http_action, params,
782783
action_url)
783784
if response is None:
784-
# My.JDownloader Api failed too.
785-
return False
785+
# My.JDownloader Api failed too we assume a problem with the connection or the api server
786+
# and throw an connection exception.
787+
raise (MYJDConnectionException("No connection established\n"))
786788
# My.JDownloader Api worked, lets refresh the direct connections and return
787789
# the response.
788790
self.__refresh_direct_connections()

0 commit comments

Comments
 (0)