Skip to content

Commit

Permalink
fix uncatched error
Browse files Browse the repository at this point in the history
  • Loading branch information
lchenut committed Mar 29, 2024
1 parent cf2d599 commit 624e32d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions webrtc/udp_connection.nim
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ proc init*(self: UdpConn, laddr: TransportAddress) =
) {.async: (raises: []), gcsafe.} =
# On receive Udp message callback, store the
# message with the corresponding remote address
trace "UDP onReceive"
let msg = udp.getMessage()
self.dataRecv.addLastNoWait((msg, raddr))
try:
trace "UDP onReceive"
let msg = udp.getMessage()
self.dataRecv.addLastNoWait((msg, raddr))
except CatchableError as exc:
raiseAssert(exc.msg)

self.dataRecv = newAsyncQueue[UdpPacketInfo]()
self.udp = newDatagramTransport(onReceive, local = laddr)
Expand Down Expand Up @@ -72,7 +75,7 @@ proc write*(
try:
await self.udp.sendTo(raddr, msg)
except TransportError as exc:
raise (ref WebRtcUdpError)(msg: msg)
raise (ref WebRtcUdpError)(msg: exc.msg)
except CancelledError as exc:
raise exc

Expand Down

0 comments on commit 624e32d

Please sign in to comment.