Skip to content

Commit 6fc1d29

Browse files
committed
raise plotly exception instead of requests exception
1 parent ded8a37 commit 6fc1d29

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

plotly/plotly/plotly.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -881,14 +881,11 @@ def parse_grid_id_args(cls, grid, grid_url, grid_id):
881881
@classmethod
882882
def response_handler(cls, response):
883883

884-
response.raise_for_status()
885-
# TODO: Maybe use some custom messages in the future?
886-
# With a lookup table like the following?
887-
# error_messages = {
888-
# 401: 'Unauthorized - are you sure that your '
889-
# 'API key is correct? Visit https://plot.ly/settings',
890-
# 503: 'Service unavailable. Having trouble connection to plotly.'
891-
# }
884+
try:
885+
response.raise_for_status()
886+
except requests.exceptions.HTTPError as requests_exception:
887+
plotly_exception = exceptions.PlotlyRequestError(requests_exception)
888+
raise(plotly_exception)
892889

893890
if ('content-type' in response.headers and
894891
'json' in response.headers['content-type'] and

0 commit comments

Comments
 (0)