File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,14 @@ Read a key
6767 client.read(' /nodes' , recursive = True ) # get all the values of a directory, recursively.
6868 client.get(' /nodes/n2' ).value
6969
70+ # raises etcd.EtcdKeyNotFound when key not found
71+ try :
72+ client.read(' /invalid/path' )
73+ except etcd.EtcdKeyNotFound:
74+ # do something
75+ print " error"
76+
77+
7078 Delete a key
7179~~~~~~~~~~~~
7280
Original file line number Diff line number Diff line change @@ -88,6 +88,12 @@ Get a key
8888 client.read(' /nodes/n2' , wait = True ) # Waits for a change in value in the key before returning.
8989 client.read(' /nodes/n2' , wait = True , waitIndex = 10 )
9090
91+ # raises etcd.EtcdKeyNotFound when key not found
92+ try :
93+ client.read(' /invalid/path' )
94+ except etcd.EtcdKeyNotFound:
95+ # do something
96+ print " error"
9197
9298
9399 Delete a key
You can’t perform that action at this time.
0 commit comments