mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-08 00:23:07 +00:00
Fix try except format
This commit is contained in:
parent
56a63f820c
commit
ac156b484a
@ -144,11 +144,12 @@ method subscribeBlocks(subscriptions: WebSocketSubscriptions,
|
|||||||
let res = Block.fromJson(arguments{"result"}).mapFailure(SubscriptionError)
|
let res = Block.fromJson(arguments{"result"}).mapFailure(SubscriptionError)
|
||||||
onBlock(res)
|
onBlock(res)
|
||||||
|
|
||||||
withLock(subscriptions):
|
try:
|
||||||
convertErrorsToSubscriptionError:
|
withLock(subscriptions):
|
||||||
let id = await subscriptions.client.eth_subscribe("newHeads")
|
convertErrorsToSubscriptionError:
|
||||||
subscriptions.callbacks[id] = callback
|
let id = await subscriptions.client.eth_subscribe("newHeads")
|
||||||
return id
|
subscriptions.callbacks[id] = callback
|
||||||
|
return id
|
||||||
except AsyncLockError as e:
|
except AsyncLockError as e:
|
||||||
error "Lock error when trying to subscribe to blocks", err = e.msg
|
error "Lock error when trying to subscribe to blocks", err = e.msg
|
||||||
raise newException(SubscriptionError, "Cannot subscribe to the blocks because of lock error")
|
raise newException(SubscriptionError, "Cannot subscribe to the blocks because of lock error")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user