Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async and swallows errors #23598

Open
nitely opened this issue May 13, 2024 · 0 comments
Open

async and swallows errors #23598

nitely opened this issue May 13, 2024 · 0 comments
Labels
Async Everything related to Nim's async

Comments

@nitely
Copy link
Contributor

nitely commented May 13, 2024

Description

The and function seems to only raise errors for the first async proc.

import std/asyncdispatch

proc ok {.async.} =
  discard

proc err {.async.} =
  raise newException(ValueError, "err")

proc main {.async.} =
  try:
    await ok() and err()
  except ValueError:
    echo "err1"
  try:
    await err() and ok()
  except ValueError:
    echo "err2"
  try:
    await ok() and ok() and err()
  except ValueError:
    echo "err3"

waitFor main()

Nim Version

Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2024-05-11
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: c91b33a
active boot switches: -d:release

Current Output

err2

Expected Output

err1
err2
err3

Possible Solution

No response

Additional Information

No response

@nitely nitely changed the title asyncdispatch and swallows errors async and swallows errors May 13, 2024
@juancarlospaco juancarlospaco added the Async Everything related to Nim's async label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Async Everything related to Nim's async
Projects
None yet
Development

No branches or pull requests

2 participants