Skip to content

Commit

Permalink
Added better return value
Browse files Browse the repository at this point in the history
  • Loading branch information
Pdzly committed Dec 17, 2023
1 parent 2eba596 commit 42518fa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lemmylib/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ def call_api(self, method: LemmyApiMethod, endpoint: str, params: dict = None, h
if response.ok:
return response
else:
raise Exception(
f"LemmyLib: API call failed with status code {response.status_code} and message {response.text}")
self._logger.error(f"LemmyLib call_api: "
f"{method} {url}"
f"{response.status_code} {response.text}")
return None

def get_base_path(self):
return f'/api/{API_VERSION}/'
Expand Down

0 comments on commit 42518fa

Please sign in to comment.