Skip to content

Commit

Permalink
fix: update error.py, use first index of list as detail (elevenlabs#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
felivalencia3 authored Jul 21, 2023
1 parent 3bef1ce commit d29377a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions elevenlabs/api/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ class HTTPError:
additional_info: Optional[Dict] = None

def __init__(self, response: requests.Response):
detail = json.loads(response.text)["detail"]
self.message = detail["message"]
self.status = detail["status"]
detail = json.loads(response.text)[0]
self.message = detail.get("msg", "Unknown error")
self.status = detail.get("status", 0)
self.additional_info = detail.get("additional_info", None)
super().__init__(self.message)


class APIError(Exception):
Expand Down

0 comments on commit d29377a

Please sign in to comment.