Skip to content

Commit

Permalink
Add documentation warning about exceptions in coroutines
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald committed Sep 5, 2014
1 parent 15c82cb commit cf9a1e9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tornado/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit cf9a1e9

Please sign in to comment.