From baf33f04eaac481251ca306258ca5877e7a45a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Wed, 12 Aug 2020 16:24:55 +0200 Subject: [PATCH] asyncCheck(): don't raise exception on cancellation (#121) --- chronos/asyncfutures2.nim | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/chronos/asyncfutures2.nim b/chronos/asyncfutures2.nim index b55b041..8f7f8b6 100644 --- a/chronos/asyncfutures2.nim +++ b/chronos/asyncfutures2.nim @@ -531,13 +531,11 @@ proc mget*[T](future: FutureVar[T]): var T = result = Future[T](future).value proc asyncCheck*[T](future: Future[T]) = - ## Sets a callback on ``future`` which raises an exception if the future - ## finished with an error. - ## - ## This should be used instead of ``discard`` to discard void futures. + ## Sets a callback on ``future`` which raises an exception in ``poll()`` if the + ## future failed. doAssert(not isNil(future), "Future is nil") proc cb(data: pointer) = - if future.failed() or future.cancelled(): + if future.failed(): when defined(chronosStackTrace): injectStacktrace(future) raise future.error