Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 769963a

Browse filesBrowse files
committed
Raise InfluxDBServerError for server error
1 parent 037a0b8 commit 769963a
Copy full SHA for 769963a

File tree

1 file changed

+6
-2
lines changed
Filter options

1 file changed

+6
-2
lines changed

‎influxdb/client.py

Copy file name to clipboardExpand all lines: influxdb/client.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@ def request(self, url, method='GET', params=None, data=None,
202202
:type expected_response_code: int
203203
:returns: the response from the request
204204
:rtype: :class:`requests.Response`
205+
:raises InfluxDBServerError: if the response code is any server error
206+
code (5xx)
205207
:raises InfluxDBClientError: if the response code is not the
206-
same as `expected_response_code`
208+
same as `expected_response_code` and is not a server error code
207209
"""
208210
url = "{0}/{1}".format(self._baseurl, url)
209211

@@ -237,7 +239,9 @@ def request(self, url, method='GET', params=None, data=None,
237239
else:
238240
raise e
239241

240-
if response.status_code == expected_response_code:
242+
if response.status_code >= 500 and response.status_code < 600:
243+
raise InfluxDBServerError(response.content)
244+
elif response.status_code == expected_response_code:
241245
return response
242246
else:
243247
raise InfluxDBClientError(response.content, response.status_code)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.