diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim index d972592a5c..9f1711f088 100644 --- a/lib/pure/asyncdispatch.nim +++ b/lib/pure/asyncdispatch.nim @@ -71,6 +71,11 @@ proc fail*[T](future: PFuture[T], error: ref EBase) = future.error = error if future.cb != nil: future.cb() + else: + # This is to prevent exceptions from being silently ignored when a future + # is discarded. + # TODO: This may turn out to be a bad idea. + raise error proc `callback=`*(future: PFutureBase, cb: proc () {.closure,gcsafe.}) = ## Sets the callback proc to be called when the future completes.