bittorrent-codex-docs/10 Notes/PR 1179 - checked exceptions in stores.md

1.2 KiB

tags related-to
codex/pulls
Codex PRs

https://github.com/codex-storage/nim-codex/pull/1179

Two things to be handled in the follow up PR:

For reference, here is the essence of the Error: Exception can raise an unlisted exception: Exception thing:

import pkg/chronos
# the problem does not occur when using std/asyncdispatch
# import std/asyncdispatch

# without "raises: []" it fails with "Error: Exception can raise an unlisted exception: Exception"
#func getIter(): (iterator (): int {.gcsafe.}) =
func getIter(): (iterator (): int {.gcsafe, raises: [].}) =
  return iterator (): int =
    yield 1
    yield 2
    yield 3

proc f1() =
  let iter = getIter()

  proc genNext(): Future[int] {.async.} =
    iter()

See also https://github.com/nim-lang/Nim/issues/3772.