#31675 closed Cleanup/optimization (fixed)
Add a warning about cyclic references in exceptions to the debug error view.
Reported by: | Chris Jerdonek | Owned by: | Hasan Ramezani |
---|---|---|---|
Component: | Error reporting | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Issue #29393 fixed a hang in the debug error view if the exception chain has a cycle. However, if it would be even more helpful if the debug error view displayed that the exception had a cycle, along with what the cycle was. The text could be to the effect of, "cycle in exception chain detected: exception <exception value> encountered again."
It would be helpful to surface this because a cycle in the exception chain usually signals an underlying problem, either with user code, Django code, a bug in Python itself, etc.
Change History (6)
comment:1 by , 4 years ago
Easy pickings: | set |
---|---|
Summary: | debug error view: show if the exception chain has a cycle → Add a warning about cyclic references in exceptions to the debug error view. |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
Version: | 3.0 → master |
follow-up: 5 comment:4 by , 4 years ago
Will the PR that was committed cause the exception to display in the error view in the list with the other exceptions? What I was suggesting is that it would be helpful if, in the debug error view, the beginning of the first repetition shows in the error view, with a description of what exception was repeated. That way, the full exception chain is visible in the error view.
comment:5 by , 4 years ago
Replying to Chris Jerdonek:
Will the PR that was committed cause the exception to display in the error view in the list with the other exceptions? What I was suggesting is that it would be helpful if, in the debug error view, the beginning of the first repetition shows in the error view, with a description of what exception was repeated. That way, the full exception chain is visible in the error view.
No, a warning will appear only in the development server console. I think it's enough since this is quite niche and I don't have an idea how to add it to the debug view frames
without a bigger refactoring. I'd be happy to review a patch with improvements if you want to work on this.
comment:6 by , 4 years ago
Yeah, I could do it as an extension to the other two when I get around to it. The approach I had in mind would use the existing template structure so the repeated exception would display normally, just with a note of some kind next to it. But it would need to come after fixing the other issue.
Thanks Chris. I think that adding a warning (
warnings.warn(...)
) about cyclic references would be an improvement. We should probably add a custom subclass ofUserWarning
, e.g.CyclicExceptionReferenceWarning
, for easy ignoring, if needed.