Code

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#5889 closed (wontfix)

handler500 example to documentation

Reported by: mikko@… Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: handler500
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Here is an example how to use handler500 to log an exception. Goes against request-response.txt

Attachments (1)

handler500_example.patch (1.4 KB) - added by Mikko Ohtamaa <mikko@…> 6 years ago.
Patch against Django trunk root

Download all attachments as: .zip

Change History (5)

Changed 6 years ago by Mikko Ohtamaa <mikko@…>

Patch against Django trunk root

comment:1 Changed 6 years ago by Mikko Ohtamaa <mikko@…>

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 years ago by ubernostrum

  • Resolution set to wontfix
  • Status changed from new to closed

I'm inclined to wontfix this, just because custom recovery from internal errors is something that people probably shouldn't be trying to do unless they already know how to.

comment:3 Changed 6 years ago by Mikko Ohtamaa <mikko@…>

Hello ubernostrum,

The point of this patch is not custom recovery, but custom logging. The documentation does point out how to handle 500 errors (show internal server error page) page, but it does not tell how to know which error there was and how to report it to the site administration.

"unless they already know how to"

The exception information is not straighforward to obtain, since the exception is not given as a parameter for the 500 handler. How people will ever know how to access this information if it's not documented somewhere?

I beg you to reconsider this ticket based on these clarifications.

comment:4 Changed 6 years ago by Mikko Ohtamaa <mikko@…>

How about just adding this sentence:

"If you want to access the exception in your handler500() function, you can use function sys.exc_info() to get the orignal exception."

exception = sys.exc_info()[0]

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.