From cf9a1e9501bb7bca1a427b3f46c1026de0f23a31 Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Fri, 5 Sep 2014 11:57:15 -0400 Subject: [PATCH] Add documentation warning about exceptions in coroutines --- tornado/gen.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tornado/gen.py b/tornado/gen.py index 4bb82d422..3d50e7cc4 100644 --- a/tornado/gen.py +++ b/tornado/gen.py @@ -136,6 +136,17 @@ def coroutine(func, replace_callback=True): From the caller's perspective, ``@gen.coroutine`` is similar to the combination of ``@return_future`` and ``@gen.engine``. + + .. warning:: + + When exceptions occur inside a coroutine, the exception + information will be stored in the `.Future` object. You must + examine the result of the `.Future` object, or the exception + may go unnoticed by your code. This means yielding the function + if called from another coroutine, using something like + `.IOLoop.run_sync` for top-level calls, or passing the `.Future` + to `.IOLoop.add_future`. + """ return _make_coroutine_wrapper(func, replace_callback=True) -- 2.47.2