Skip to content

Commit 3993829

Browse files
committed
andrew's comments
1 parent 4b53e78 commit 3993829

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

plotly/plotly/plotly.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,8 +1593,17 @@ def create_animations(figure, filename=None, sharing='public', auto_open=True):
15931593
parsed_response = r.content
15941594

15951595
# raise error message
1596-
if r.ok is False:
1597-
raise exceptions.PlotlyError(parsed_response['errors'][-1]['message'])
1596+
if not r.ok:
1597+
message = ''
1598+
if isinstance(parsed_response, dict):
1599+
errors = parsed_response.get('errors')
1600+
if errors and errors[-1].get('message'):
1601+
message = errors[-1]['message']
1602+
if message:
1603+
raise exceptions.PlotlyError(message)
1604+
else:
1605+
# shucks, we're stuck with a generic error...
1606+
r.raise_for_status()
15981607

15991608
if sharing == 'secret':
16001609
web_url = (parsed_response['file']['web_url'][:-1] +

0 commit comments

Comments
 (0)