normalize sentence spacing
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent 569c88d · Browse files · 1 file·+19 added−19 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+19 added−19 removed
- other:+19 added−19 removed
Provenance
- Commit
0db9525- Tree
7bd007b- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
569c88d
1 file changed+19 added−19 removed
modified:docs/errorhandling.rst+19 added-19 removed
1 unmodified line2 ===========================3 4 .. versionadded:: 0.35 6-Applications fail, servers fail. Sooner or later you will see an exception7-in production. Even if your code is 100% correct, you will still see8-exceptions from time to time. Why? Because everything else involved will9-fail. Here are some situations where perfectly fine code can lead to server6+Applications fail, servers fail. Sooner or later you will see an exception7+in production. Even if your code is 100% correct, you will still see8+exceptions from time to time. Why? Because everything else involved will9+fail. Here are some situations where perfectly fine code can lead to server10 errors:11 12 - the client terminated the request early and the application was still13 reading from the incoming data3 unmodified lines17 - a backend server overloaded18 - a programming error in a library you are using19 - network connection of the server to another system failed20 21-And that's just a small sample of issues you could be facing. So how do we22-deal with that sort of problem? By default if your application runs in21+And that's just a small sample of issues you could be facing. So how do we22+deal with that sort of problem? By default if your application runs in23 production mode, and an exception is raised Flask will display a very simple24 page for you and log the exception to the :attr:`~flask.Flask.logger`.25 26 But there is more you can do, and we will cover some better setups to deal11 unmodified lines38 syntax, missing query parameters, etc.39 40 *403 Forbidden*41 If you have some kind of access control on your website, you will have42- to send a 403 code for disallowed resources. So make sure the user42+ to send a 403 code for disallowed resources. So make sure the user43 is not lost when they try to access a forbidden resource.44 45 *404 Not Found*46- The good old "chap, you made a mistake typing that URL" message. So46+ The good old "chap, you made a mistake typing that URL" message. So47 common that even novices to the internet know that 404 means: damn,48- the thing I was looking for is not there. It's a very good idea to48+ the thing I was looking for is not there. It's a very good idea to49 make sure there is actually something useful on a 404 page, at least a50 link back to the index.51 52 *410 Gone*53 Did you know that there the "404 Not Found" has a brother named "41054- Gone"? Few people actually implement that, but the idea is that54+ Gone"? Few people actually implement that, but the idea is that55 resources that previously existed and got deleted answer with 41056- instead of 404. If you are not deleting documents permanently from56+ instead of 404. If you are not deleting documents permanently from57 the database but just mark them as deleted, do the user a favour and58 use the 410 code instead and display a message that what they were59 looking for was deleted for all eternity.60 7 unmodified lines68 69 Sending error mails, even if just for critical ones, can become70 overwhelming if enough users are hitting the error and log files are71 typically never looked at. This is why we recommend using `Sentry72-<https://sentry.io/>`_ for dealing with application errors. It's72+<https://sentry.io/>`_ for dealing with application errors. It's73 available as an Open Source project `on GitHub74 <https://github.com/getsentry/sentry>`_ and is also available as a `hosted version75 <https://sentry.io/signup/>`_ which you can try for free. Sentry76 aggregates duplicate errors, captures the full stack trace and local20 unmodified lines97 98 Follow-up reads:99 100 * Sentry also supports catching errors from your worker queue (RQ, Celery) in a101- similar fashion. See the `Python SDK docs101+ similar fashion. See the `Python SDK docs102 <https://docs.sentry.io/platforms/python/>`_ for more information.103 * `Getting started with Sentry <https://docs.sentry.io/quickstart/?platform=python>`_104 * `Flask-specific documentation <https://docs.sentry.io/platforms/python/flask/>`_.105 315 unmodified lines421 Blueprint Error Handling422 ````````````````````````423 424 In blueprints, error handlers will work as expected. However, there is a caveat425-concerning handlers for 404 and 405 exceptions. These error handlers are only425+concerning handlers for 404 and 405 exceptions. These error handlers are only426 invoked from an appropriate ``raise`` statement or a call to ``abort`` in another427 of the blueprint's view functions; they are not invoked by, e.g., an invalid URL428 access.429 128 unmodified lines558 559 When in Doubt, Run Manually560 ---------------------------561 562-Having problems getting your application configured for production? If you562+Having problems getting your application configured for production? If you563 have shell access to your host, verify that you can run your application564-manually from the shell in the deployment environment. Be sure to run under564+manually from the shell in the deployment environment. Be sure to run under565 the same user account as the configured deployment to troubleshoot permission566-issues. You can use Flask's builtin development server with `debug=True` on566+issues. You can use Flask's builtin development server with `debug=True` on567 your production host, which is helpful in catching configuration issues, but568 **be sure to do this temporarily in a controlled environment.** Do not run in569 production with `debug=True`.570 3 unmodified lines574 Working with Debuggers575 ----------------------576 577 To dig deeper, possibly to trace code execution, Flask provides a debugger out578-of the box (see :ref:`debug-mode`). If you would like to use another Python579-debugger, note that debuggers interfere with each other. You have to set some578+of the box (see :ref:`debug-mode`). If you would like to use another Python579+debugger, note that debuggers interfere with each other. You have to set some580 options in order to use your favorite debugger:581 582 * ``debug`` - whether to enable debug mode and catch exceptions583 * ``use_debugger`` - whether to use the internal Flask debugger26 unmodified lines