File tree 3 files changed +19
-4
lines changed 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 1
1
## 1.25.0 [ unreleased]
2
2
3
+ ### Bug Fixes
4
+ 1 . [ #375 ] ( https://github.com/influxdata/influxdb-client-python/pull/375 ) : Construct ` InfluxDBError ` without HTTP response
5
+
3
6
### CI
4
- 1 . [ #54 ] ( https://github.com/influxdata/influxdb-client-python/pull/370 ) : Add Python 3.10 to CI builds
7
+ 1 . [ #370 ] ( https://github.com/influxdata/influxdb-client-python/pull/370 ) : Add Python 3.10 to CI builds
8
+
5
9
## 1.24.0 [ 2021-11-26]
6
10
7
11
### Features
Original file line number Diff line number Diff line change @@ -12,9 +12,14 @@ class InfluxDBError(Exception):
12
12
13
13
def __init__ (self , response : HTTPResponse ):
14
14
"""Initialize the InfluxDBError handler."""
15
- self .response = response
16
- self .message = self ._get_message (response )
17
- self .retry_after = response .getheader ('Retry-After' )
15
+ if response is not None :
16
+ self .response = response
17
+ self .message = self ._get_message (response )
18
+ self .retry_after = response .getheader ('Retry-After' )
19
+ else :
20
+ self .response = None
21
+ self .message = 'no response'
22
+ self .retry_after = None
18
23
super ().__init__ (self .message )
19
24
20
25
def _get_message (self , response ):
Original file line number Diff line number Diff line change @@ -46,3 +46,9 @@ def test_message_get_retry_after(self):
46
46
influx_db_error = InfluxDBError (response = HTTPResponse (reason = "too many requests" ))
47
47
self .assertEqual ("too many requests" , str (influx_db_error ))
48
48
self .assertEqual (None , influx_db_error .retry_after )
49
+
50
+ def test_no_response (self ):
51
+ influx_db_error = InfluxDBError (response = None )
52
+ self .assertEqual ("no response" , str (influx_db_error ))
53
+ self .assertIsNone (influx_db_error .response )
54
+ self .assertIsNone (influx_db_error .retry_after )
You can’t perform that action at this time.
0 commit comments