Skip to content

Commit 24e4542

Browse files
committed
Merge pull request influxdata#43 from jhermann/fix-InfluxDBClientError
Proper InfluxDBClientError init
2 parents 63596e4 + 7d33468 commit 24e4542

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

influxdb/client.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99

1010

1111
class InfluxDBClientError(Exception):
12-
"Raised when an error occures in the Request"
13-
def __init__(self, message, code):
14-
self.message = message
12+
"Raised when an error occurs in the request"
13+
def __init__(self, content, code):
14+
super(InfluxDBClientError, self).__init__(
15+
"{0}: {1}".format(code, content))
16+
self.content = content
1517
self.code = code
1618

1719

@@ -118,13 +120,8 @@ def request(self, url, method='GET', params=None, data=None,
118120

119121
if response.status_code == status_code:
120122
return response
121-
122123
else:
123-
error = InfluxDBClientError(
124-
"{0}: {1}".format(response.status_code, response.content),
125-
response.status_code
126-
)
127-
raise error
124+
raise InfluxDBClientError(response.content, response.status_code)
128125

129126
# Writing Data
130127
#

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy