@@ -47,11 +47,8 @@ method delete*(
4747 pending = await allFinished (self.stores.mapIt (it.delete (key)))
4848
4949 for fut in pending:
50- try :
51- if fut.read ().isErr:
52- return fut.read ()
53- except FuturePendingError as err:
54- return failure err
50+ let res = await fut
51+ if res.isErr: return res
5552
5653 return success ()
5754
@@ -64,11 +61,8 @@ method delete*(
6461 pending = await allFinished (self.stores.mapIt (it.delete (key)))
6562
6663 for fut in pending:
67- try :
68- if fut.read ().isErr:
69- return fut.read ()
70- except FuturePendingError as err:
71- return failure err
64+ let res = await fut
65+ if res.isErr: return res
7266
7367 return success ()
7468
@@ -105,11 +99,8 @@ method put*(
10599 pending = await allFinished (self.stores.mapIt (it.put (key, data)))
106100
107101 for fut in pending:
108- try :
109- if fut.read ().isErr:
110- return fut.read ()
111- except FuturePendingError as err:
112- return failure err
102+ let res = await fut
103+ if res.isErr: return res
113104
114105 return success ()
115106
@@ -122,11 +113,8 @@ method put*(
122113 pending = await allFinished (self.stores.mapIt (it.put (entry.key, entry.data)))
123114
124115 for fut in pending:
125- try :
126- if fut.read ().isErr:
127- return fut.read ()
128- except FuturePendingError as err:
129- return failure err
116+ let res = await fut
117+ if res.isErr: return res
130118
131119 return success ()
132120
@@ -141,13 +129,9 @@ method modifyGet*(
141129 var aux = newSeq [byte ]()
142130
143131 for fut in pending:
144- try :
145- if fut.read ().isErr:
146- return fut.read ()
147- else :
148- aux.add (fut.read ().get)
149- except FuturePendingError as err:
150- return failure err
132+ let res = await fut
133+ if res.isErr: return res
134+ aux.add (res.get)
151135
152136 return success (aux)
153137
@@ -160,11 +144,8 @@ method modify*(
160144 pending = await allFinished (self.stores.mapIt (it.modify (key, fn)))
161145
162146 for fut in pending:
163- try :
164- if fut.read ().isErr:
165- return fut.read ()
166- except FuturePendingError as err:
167- return failure err
147+ let res = await fut
148+ if res.isErr: return res
168149
169150 return success ()
170151
0 commit comments