Opened 10 years ago

Closed 10 years ago

Last modified 3 months ago

#5046 closed Cleanup/optimization (fixed)

views/debug.py: Display string of UnicodeError

Reported by: Thomas Güttler <hv@…> Owned by: Adrian Holovaty
Component: Error reporting Version: master
Severity: Normal Keywords: unicode
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

if you get an UnicodeError in debug.py you don't see
the string, which contains the non utf8 character.

This small patch adds a hint, if the exception is an UnicodeError.
The hint displays some character before and after the wrong
character.

Attachments (2)

views_debug_unicodeerror_hint.diff (1.1 KB) - added by Thomas Güttler <hv@…> 10 years ago.
views_debug_unicodeerror_hint.2.diff (1.1 KB) - added by Thomas Güttler <hv@…> 10 years ago.

Download all attachments as: .zip

Change History (9)

Changed 10 years ago by Thomas Güttler <hv@…>

comment:3 Changed 10 years ago by Thomas Güttler <hv@…>

Component: UncategorizedMetasystem
Owner: changed from Jacob to Adrian Holovaty

comment:5 Changed 10 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedReady for checkin

Changed 10 years ago by Thomas Güttler <hv@…>

comment:6 Changed 10 years ago by Thomas Güttler <hv@…>

the second diff (views_debug_unicodeerror_hint.2.diff) fixes a typo of
the first diff: smart_unicode(..., errors="replace")

comment:7 Changed 10 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [5862]) Fixed #5046 -- Added 'Unicode error hint' section to debug page in the case of a UnicodeError. Thanks, Thomas Guttler

comment:8 Changed 3 months ago by Tim Graham

Component: MetasystemError reporting
Easy pickings: unset
Severity: Normal
Type: Cleanup/optimization
UI/UX: unset

10 years later, I noticed these lines aren't tested. I'm not sure if this feature is still needed in a Python 3-only world as I'd think the problematic string would appear in the " Local vars" section of the traceback but there aren't steps to reproduce so perhaps you could give an insight if you remember anything about the original issue, Thomas?

In case the feature in still useful, I made a PR to add a test.

comment:9 Changed 3 months ago by Tim Graham <timograham@…>

In 74b7a20:

Refs #5046 -- Tested the 'unicode hint' in the technical 500 debug view.

comment:10 Changed 3 months ago by Thomas Güttler

thank you

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