Changes between Version 3 and Version 7 of Ticket #30752


Ignore:
Timestamp:
Sep 11, 2019, 4:17:11 AM (5 years ago)
Author:
Carlton Gibson
Comment:

Hi Pavel, thanks for your input.

You're absolutely correct re the handler500 suggestion. That's not sufficient at all. (I'm not sure quite what was in my head thinking about this.) I've adjusted the description appropriately.

Looking at it, there's no nice way to pass down the exception reporter class so, I agree, a setting will be the easiest way forward.

Your PR looks more or less right, but I think we need to say more in the Custom error reports section of the docs. Specifically we should probably begin stating that the reports are created by the ExceptionReporter class, and that it uses an ExceptionReporterFilter to control the filtering. Then then existing filtering examples are OK — that's the first port of call ‚ before giving an override example for ExceptionReporter...

class CustomExceptionReporter(ExceptionReporter):
    def get_traceback_data(self):
        data = super().get_traceback_data()
        # ... remove/add something here...
        return data

That should be about it. (I'm not sure there's any demand to customise anything else on ExceptionReporter.)

Thanks again, super stuff.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30752

    • Property Cc Pavel Lysak added
    • Property Owner set to Pavel Lysak
    • Property Status newassigned
    • Property Has patch set
    • Property Needs documentation set
  • Ticket #30752 – Description

    v3 v7  
    55[https://github.com/django/django/blob/52e9c753659ffeab67149fcf26b95c10cf137c40/django/views/debug.py#L84-L95 Currently the use of `ExceptionReporter` is hardcoded.]
    66
    7 * Move this to a parameter
    8 * Provide an example of using, e.g., `functools.partial` to configure a subclass when specifying `handler500`.
     7~~* Move this to a parameter~~
     8~~* Provide an example of using, e.g., `functools.partial` to configure a subclass when specifying `handler500`.~~
     9
     10**Updated** for [https://code.djangoproject.com/ticket/30752#comment:5 comment:5]
     11
     12* Add `ExceptionReporter` to the documentation, explaining the relation between the exception reporter class and the filter it uses, and showing a simple override of `get_traceback_data()`.
     13* Add a `DEFAULT_EXCEPTION_REPORTER` setting to allow specifying this.
     14
     15(At that point we could review deprecating `DEFAULT_EXCEPTION_REPORTER_FILTER`, as was discussed on #25167 — but maybe that's unnecessary. Thoughts?)
Back to Top