mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-02-14 18:43:29 +00:00
fixup error handling
This commit is contained in:
parent
b80a715993
commit
d1fd4176cf
@ -40,7 +40,7 @@ type
|
||||
var
|
||||
EmptyCid {.threadvar.}: array[CIDv0..CIDv1, Table[MultiCodec, Cid]]
|
||||
|
||||
template emptyCid*(version: CidVersion, codex: MultiCodec): ?!Cid =
|
||||
proc emptyCid*(version: CidVersion, codex: MultiCodec): ?!Cid =
|
||||
once:
|
||||
EmptyCid = [
|
||||
CIDv0: {
|
||||
@ -112,11 +112,7 @@ proc emptyBlock*(version: CidVersion, codex: MultiCodec): ?!Block =
|
||||
|
||||
|
||||
proc isEmpty*(cid: Cid): bool =
|
||||
cid == EmptyCid[cid.cidver]
|
||||
.catch
|
||||
.get()[cid.mhash.get().mcodec]
|
||||
.catch
|
||||
.get()
|
||||
cid == emptyCid(cid.cidver, cid.mhash.get().mcodec).get()
|
||||
|
||||
proc isEmpty*(blk: Block): bool =
|
||||
blk.cid.isEmpty
|
||||
|
||||
@ -73,11 +73,7 @@ checksuite "Manifest":
|
||||
|
||||
# fill up with empty Cid's
|
||||
for i in protected.rounded..<protected.len:
|
||||
protected[i] = EmptyCid[manifest.version]
|
||||
.catch
|
||||
.get()[manifest.hcodec]
|
||||
.catch
|
||||
.get()
|
||||
protected[i] = emptyCid(manifest.version, manifest.hcodec).get()
|
||||
|
||||
var
|
||||
encoded = protected.encode().tryGet()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user