avoid using the msg key in chronicles (#2970)

This commit is contained in:
gabrielmer 2024-08-14 16:40:08 +02:00 committed by GitHub
parent dfd42a7cb1
commit 225b5e7260
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View File

@ -397,14 +397,14 @@ proc publish*(
if node.wakuRelay.isNil(): if node.wakuRelay.isNil():
let msg = let msg =
"Invalid API call to `publish`. WakuRelay not mounted. Try `lightpush` instead." "Invalid API call to `publish`. WakuRelay not mounted. Try `lightpush` instead."
error "publish error", msg = msg error "publish error", err = msg
# TODO: Improve error handling # TODO: Improve error handling
return err(msg) return err(msg)
let pubsubTopic = pubsubTopicOp.valueOr: let pubsubTopic = pubsubTopicOp.valueOr:
node.wakuSharding.getShard(message.contentTopic).valueOr: node.wakuSharding.getShard(message.contentTopic).valueOr:
let msg = "Autosharding error: " & error let msg = "Autosharding error: " & error
error "publish error", msg = msg error "publish error", err = msg
return err(msg) return err(msg)
#TODO instead of discard return error when 0 peers received the message #TODO instead of discard return error when 0 peers received the message
@ -1105,7 +1105,7 @@ proc lightpushPublish*(
peerOpt = node.peerManager.selectPeer(WakuLightPushCodec) peerOpt = node.peerManager.selectPeer(WakuLightPushCodec)
if peerOpt.isNone(): if peerOpt.isNone():
let msg = "no suitable remote peers" let msg = "no suitable remote peers"
error "failed to publish message", msg = msg error "failed to publish message", err = msg
return err(msg) return err(msg)
elif not node.wakuLightPush.isNil(): elif not node.wakuLightPush.isNil():
peerOpt = some(RemotePeerInfo.init($node.switch.peerInfo.peerId)) peerOpt = some(RemotePeerInfo.init($node.switch.peerInfo.peerId))

View File

@ -30,7 +30,7 @@ proc getSecureKey(path: string): TLSPrivateKey {.raises: [Defect, IOError].} =
let key = TLSPrivateKey.init(stringkey) let key = TLSPrivateKey.init(stringkey)
return key return key
except TLSStreamProtocolError as exc: except TLSStreamProtocolError as exc:
debug "exception raised from getSecureKey", msg = exc.msg debug "exception raised from getSecureKey", err = exc.msg
proc getSecureCert(path: string): TLSCertificate {.raises: [Defect, IOError].} = proc getSecureCert(path: string): TLSCertificate {.raises: [Defect, IOError].} =
trace "Certificate path is.", path = path trace "Certificate path is.", path = path
@ -39,7 +39,7 @@ proc getSecureCert(path: string): TLSCertificate {.raises: [Defect, IOError].} =
let cert = TLSCertificate.init(stringCert) let cert = TLSCertificate.init(stringCert)
return cert return cert
except TLSStreamProtocolError as exc: except TLSStreamProtocolError as exc:
debug "exception raised from getSecureCert", msg = exc.msg debug "exception raised from getSecureCert", err = exc.msg
proc withWssTransport*( proc withWssTransport*(
b: SwitchBuilder, secureKeyPath: string, secureCertPath: string b: SwitchBuilder, secureKeyPath: string, secureCertPath: string

View File

@ -259,7 +259,7 @@ proc installRelayApiHandlers*(
let pubsubTopic = node.wakuSharding.getShard(message.contentTopic).valueOr: let pubsubTopic = node.wakuSharding.getShard(message.contentTopic).valueOr:
let msg = "Autosharding error: " & error let msg = "Autosharding error: " & error
error "publish error", msg = msg error "publish error", err = msg
return RestApiResponse.badRequest("Failed to publish. " & msg) return RestApiResponse.badRequest("Failed to publish. " & msg)
# if RLN is mounted, append the proof to the message # if RLN is mounted, append the proof to the message