Skip to content

Commit

Permalink
group frames by exception
Browse files Browse the repository at this point in the history
revert to showing only exception at top and bottom
add render_text method
don't prepend module for "builtins"
remove handling for unsupported "raise string"
use property as decorator
use to_unicode and text_type compat
  • Loading branch information
davidism committed Dec 6, 2018
1 parent 3245e58 commit b08fa69
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 152 deletions.
15 changes: 9 additions & 6 deletions tests/test_debug.py
Expand Up @@ -202,21 +202,24 @@ def test_debug_help(self):
assert 'Help on list object' in x
assert '__delitem__' in x

@pytest.mark.skipif(PY2, reason='Exc from Exc syntax only in py3')
@pytest.mark.skipif(PY2, reason="Python 2 doesn't have chained exceptions.")
def test_exc_divider_found_on_chained_exception(self):
@Request.application
def app(environ):
def app(request):
def do_something():
raise ValueError("Inner Exception")
raise ValueError("inner")
try:
do_something()
except Exception as err: # noqa: ignore=F841
eval('raise ValueError("Outer Exception") from e')
except ValueError:
raise KeyError("outer")

debugged = DebuggedApplication(app)
client = Client(debugged, Response)
response = client.get("/")
assert '<div class="exc-divider">' in response.data.decode('utf-8')
data = response.get_data(as_text=True)
assert u'raise ValueError("inner")' in data
assert u'<div class="exc-divider">' in data
assert u'raise KeyError("outer")' in data


class TestTraceback(object):
Expand Down
8 changes: 5 additions & 3 deletions werkzeug/debug/shared/style.css
Expand Up @@ -143,7 +143,9 @@ div.pin-prompt .inner {
}

div.exc-divider {
font-weight: bold;
background: rgba(136, 252, 219, 1); /* #f9f98b */
padding: 7px;
margin: 0.7em 0 0 -1em;
padding: 0.5em;
background: #11557C;
color: #ddd;
border: 1px solid #ddd;
}

0 comments on commit b08fa69

Please sign in to comment.