From a8095d871ed0066fafa7d3195e73abf08724bcbb Mon Sep 17 00:00:00 2001 From: Aaryamann Challani <43716372+rymnc@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:58:27 +0530 Subject: [PATCH] fix(rln-db-inspector): use valueOr pattern (#2012) --- tools/rln_db_inspector/rln_db_inspector.nim | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tools/rln_db_inspector/rln_db_inspector.nim b/tools/rln_db_inspector/rln_db_inspector.nim index d06b582f19..864f506127 100644 --- a/tools/rln_db_inspector/rln_db_inspector.nim +++ b/tools/rln_db_inspector/rln_db_inspector.nim @@ -19,29 +19,23 @@ logScope: when isMainModule: {.pop.} # 1. load configuration - let conf = RlnDbInspectorConf.loadConfig().isOkOr: - error "failure while loading the configuration", error=confRes.error + let conf = RlnDbInspectorConf.loadConfig().valueOr: + error "failure while loading the configuration", error quit(1) trace "configuration", conf = $conf # 2. initialize rlnInstance - let rlnInstanceRes = createRLNInstance(d=20, - tree_path = conf.rlnRelayTreePath) - if rlnInstanceRes.isErr(): - error "failure while creating RLN instance", error=rlnInstanceRes.error + let rlnInstance = createRLNInstance(d=20, + tree_path = conf.rlnRelayTreePath).valueOr: + error "failure while creating RLN instance", error quit(1) - let rlnInstance = rlnInstanceRes.get() - # 3. get metadata - let metadataGetRes = rlnInstance.getMetadata() - if metadataGetRes.isErr(): - error "failure while getting RLN metadata", error=metadataGetRes.error + let metadata = rlnInstance.getMetadata().valueOr: + error "failure while getting RLN metadata", error quit(1) - let metadata = metadataGetRes.get() - info "RLN metadata", lastProcessedBlock = metadata.lastProcessedBlock, chainId = metadata.chainId, contractAddress = metadata.contractAddress,