Don't crash on non WakuMessage in rpc subscribe (#175)

Instead, log stringified version. (This is used for other PoC right now.)
This commit is contained in:
Oskar Thorén 2020-09-22 10:14:39 +08:00 committed by GitHub
parent 255e762536
commit 21283d291c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -54,11 +54,11 @@ proc setupWakuRPC*(node: WakuNode, rpcsrv: RpcServer) =
let msg = WakuMessage.init(data)
if msg.isOk():
debug "waku_subscribe handler", msg=msg
var readable_str = cast[string](msg[].payload)
info "Hit subscribe handler", topic=topic, msg=msg[], payload=readable_str
else:
warn "waku_subscribe decode error", msg=msg
var readable_str = cast[string](msg[].payload)
info "Hit subscribe handler", topic=topic, msg=msg[], payload=readable_str
info "waku_subscribe raw data string", str=cast[string](data)
# XXX: Can we make this context async to use await?
discard node.subscribe(topic, handler)