Handle etcd connection error

This commit is contained in:
Nico Schottelius 2020-01-10 10:10:37 +01:00
parent feb334cf04
commit 92f985c857

View file

@ -65,6 +65,8 @@ class Etcd3Wrapper:
event_iterator = self.client.get_prefix(*args, **kwargs) event_iterator = self.client.get_prefix(*args, **kwargs)
for e in event_iterator: for e in event_iterator:
yield EtcdEntry(*e[::-1], value_in_json=value_in_json) yield EtcdEntry(*e[::-1], value_in_json=value_in_json)
except etcd3.exceptions.ConnectionFailedError as e:
raise UncloudException("Cannot connect to etcd: {}".format(e))
except Exception as err: except Exception as err:
if raise_exception: if raise_exception:
raise Exception('Exception in etcd_wrapper.get_prefix') from err raise Exception('Exception in etcd_wrapper.get_prefix') from err