chore(nim): Adds try/catch block to fromEvent
This commit is contained in:
parent
73eb12c914
commit
54709cb1c5
|
@ -1,4 +1,4 @@
|
||||||
import json
|
import json, chronicles
|
||||||
|
|
||||||
import base
|
import base
|
||||||
import signal_type
|
import signal_type
|
||||||
|
@ -10,8 +10,12 @@ type StatusUpdatesTimedoutSignal* = ref object of Signal
|
||||||
statusUpdates*: seq[StatusUpdateDto]
|
statusUpdates*: seq[StatusUpdateDto]
|
||||||
|
|
||||||
proc fromEvent*(T: type StatusUpdatesTimedoutSignal, jsonSignal: JsonNode): StatusUpdatesTimedoutSignal =
|
proc fromEvent*(T: type StatusUpdatesTimedoutSignal, jsonSignal: JsonNode): StatusUpdatesTimedoutSignal =
|
||||||
|
try:
|
||||||
result = StatusUpdatesTimedoutSignal()
|
result = StatusUpdatesTimedoutSignal()
|
||||||
result.signalType = SignalType.StatusUpdatesTimedout
|
result.signalType = SignalType.StatusUpdatesTimedout
|
||||||
for jsonStatusUpdate in jsonSignal["event"]:
|
for jsonStatusUpdate in jsonSignal["event"]:
|
||||||
var statusUpdate = jsonStatusUpdate.toStatusUpdateDto()
|
var statusUpdate = jsonStatusUpdate.toStatusUpdateDto()
|
||||||
result.statusUpdates.add(statusUpdate)
|
result.statusUpdates.add(statusUpdate)
|
||||||
|
except Exception as e:
|
||||||
|
let errDescription = e.msg
|
||||||
|
error "error from event: ", errDescription
|
||||||
|
|
Loading…
Reference in New Issue