Remove usage of getCurrentException().
This commit is contained in:
cheatfate 2019-11-28 20:58:56 +02:00
parent 253aa7cf75
commit dde8c01448
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
2 changed files with 5 additions and 10 deletions

View File

@ -894,9 +894,8 @@ proc openStream*(api: DaemonAPI, peer: PeerID,
stream.flags.incl(Outbound)
stream.transp = transp
result = stream
except:
finally:
await api.closeConnection(transp)
raise getCurrentException()
proc streamHandler(server: StreamServer, transp: StreamTransport) {.async.} =
var api = getUserData[DaemonAPI](server)
@ -933,14 +932,12 @@ proc addHandler*(api: DaemonAPI, protocols: seq[string],
protocols))
pb.withMessage() do:
api.servers.add(P2PServer(server: server, address: maddress))
except:
finally:
for item in protocols:
api.handlers.del(item)
server.stop()
server.close()
await server.join()
raise getCurrentException()
finally:
await api.closeConnection(transp)
proc listPeers*(api: DaemonAPI): Future[seq[PeerInfo]] {.async.} =
@ -1301,9 +1298,8 @@ proc pubsubSubscribe*(api: DaemonAPI, topic: string,
ticket.transp = transp
asyncCheck pubsubLoop(api, ticket)
result = ticket
except:
finally:
await api.closeConnection(transp)
raise getCurrentException()
proc `$`*(pinfo: PeerInfo): string =
## Get string representation of ``PeerInfo`` object.

View File

@ -1,4 +1,3 @@
## Nim-LibP2P
## Copyright (c) 2019 Status Research & Development GmbH
## Licensed under either of
@ -405,8 +404,8 @@ proc readLoop(sconn: SecureConnection, stream: BufferStream) {.async.} =
try:
let msg = await sconn.readMessage()
await stream.pushTo(msg)
except:
trace "exception in secio", exc = getCurrentExceptionMsg()
except CatchableError as exc:
trace "exception in secio", exc = exc
return
finally:
trace "ending secio readLoop"