Skip to content

Raise errors close to calling code. #3

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions proposal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,12 @@ sections on `The start_response() Callable`_ and `Error Handling`_.
It is used only when the application has trapped an error and is
attempting to display an error message to the browser.

The ``start_response`` callable **should** perform any header verification and
checking that will take place before it returns (or raises an error), rather
than deferring it until body bytes are supplied (either via an iterator or the
``write`` callable). This ensures that exceptons are raised as close to the
failing code as possible.

The ``start_response`` callable must return a ``write(body_data)``
callable that takes one positional parameter: a bytestring to be written
as part of the HTTP response body. (Note: the ``write()`` callable is
Expand Down