Opened 13 years ago

Closed 12 years ago

#16227 closed New feature (wontfix)

Include traceback in a comment when hitting an exception in debug mode

Reported by: Daniel Watkins Owned by: nobody
Component: Core (Other) Version: 1.3
Severity: Normal Keywords:
Cc: djangoproject.com@…, Daniel Watkins, anton@…, philipkimmey, oliver@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

As discussed on the mailing list, debugging can be a real pain using curl or when dealing with AJAX, as one has to manually parse the HTML.

It would be better if the traceback could be provided in an HTML comment near the top of the file, as this will not impact the normal display at all, but make debugging in these cases a vastly more pleasant experience.

Attachments (1)

traceback-in-comment.patch (2.2 KB ) - added by Daniel Watkins 13 years ago.

Download all attachments as: .zip

Change History (14)

by Daniel Watkins, 13 years ago

Attachment: traceback-in-comment.patch added

comment:1 by Matt Harasymczuk, 13 years ago

Cc: djangoproject.com@… added

comment:3 by Daniel Watkins, 13 years ago

Cc: Daniel Watkins added

comment:4 by Aymeric Augustin, 13 years ago

Triage Stage: UnreviewedDesign decision needed
UI/UX: set

comment:5 by Anton Strogonoff, 13 years ago

Cc: anton@… added

comment:6 by Julien Phalip, 13 years ago

Type: UncategorizedNew feature

comment:7 by philipkimmey, 13 years ago

I've been thinking about this one quite a bit, and my suspicion is the most common inconvenience is seeing the full HTML dump when making AJAX requests.

I'm curious how commonly people are using curl (or similar methods).

At least personally, maybe 35% of the time I see an error message it's in Chrome's debug console.

My personal preference would be to simply have massively simplified templates (e.g. not HTML) for the common case of AJAX requests. We could have inline TECHNICAL_AJAX_*_TEMPLATE or something along those lines. Then we can just use request.is_ajax() to choose the template.

Although it doesn't resolve the case of using curl, if AJAX is the common case, I think it would be worth the minor increase in complexity.

If there is interest in something along these lines, I would be happy to contribute a patch.

comment:8 by philipkimmey, 13 years ago

Cc: philipkimmey added

comment:9 by Ramiro Morales, 13 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #10841.

comment:10 by Oliver Beattie, 13 years ago

Cc: oliver@… added
Resolution: duplicate
Status: closedreopened

I'm reopening this as I think the scope of this is different to #10841.

While that helps a great deal for debugging AJAX requests, it still doesn't cover the case where the requests aren't AJAX, but your client is still not a browser; for instance, when debugging a REST API (when you're almost certainly going to be using command-line tools to test things).

I think it's be very helpful to include a standard-format traceback at the bottom of the document in a HTML comment; it would make debugging vastly easier. For what it's worth, this is something other frameworks are already doing (Flask springs to mind). Given how simple this is to implement, and in view that it wouldn't have any chance of introducing problems – there is already a standard-format traceback in the copy-and-paste view half way up the page after all – I think it's a total no-brainer.

comment:11 by Aymeric Augustin, 13 years ago

Component: UncategorizedCore (Other)

comment:12 by Aymeric Augustin, 12 years ago

Status: reopenednew

comment:13 by Florian Apolloner, 12 years ago

Resolution: wontfix
Status: newclosed

I think we don't need a feature like this, with the LOGGING framework you can easily add a console handler to 'django.request' and get a trace in the runserver console.

Note: See TracTickets for help on using tickets.
Back to Top