-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
More compact display of vendor code in exception pages #26671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,14 @@ | |
<div class="trace-head"> | ||
<span class="sf-toggle" data-toggle-selector="#trace-html-{{ index }}" data-toggle-initial="{{ expand ? 'display' }}"> | ||
<h3 class="trace-class"> | ||
<span class="icon icon-close">{{ include('@Twig/images/icon-minus-square-o.svg') }}</span> | ||
<span class="icon icon-open">{{ include('@Twig/images/icon-plus-square-o.svg') }}</span> | ||
|
||
<span class="trace-namespace"> | ||
{{ exception.class|split('\\')|slice(0, -1)|join('\\') }} | ||
{{- exception.class|split('\\')|length > 1 ? '\\' }} | ||
</span> | ||
{{ exception.class|split('\\')|last }} | ||
|
||
<span class="icon icon-close">{{ include('@Twig/images/icon-minus-square-o.svg') }}</span> | ||
<span class="icon icon-open">{{ include('@Twig/images/icon-plus-square-o.svg') }}</span> | ||
</h3> | ||
|
||
{% if exception.message is not empty and index > 1 %} | ||
|
@@ -22,10 +22,11 @@ | |
<div id="trace-html-{{ index }}" class="sf-toggle-content"> | ||
{% set _is_first_user_code = true %} | ||
{% for i, trace in exception.trace %} | ||
{% set _display_code_snippet = _is_first_user_code and ('/vendor/' not in trace.file) and ('/var/cache/' not in trace.file) and (trace.file is not empty) %} | ||
{% set _is_vendor_trace = trace.file is not empty and ('/vendor/' in trace.file or '/var/cache/' in trace.file) %} | ||
{% set _display_code_snippet = _is_first_user_code and not _is_vendor_trace %} | ||
{% if _display_code_snippet %}{% set _is_first_user_code = false %}{% endif %} | ||
<div class="trace-line"> | ||
{{ include('@Twig/Exception/trace.html.twig', { prefix: index, i: i, trace: trace, _display_code_snippet: _display_code_snippet }, with_context = false) }} | ||
<div class="trace-line {{ _is_vendor_trace ? 'trace-from-vendor' }}"> | ||
{{ include('@Twig/Exception/trace.html.twig', { prefix: index, i: i, trace: trace, style: _is_vendor_trace ? 'compact' : _display_code_snippet ? 'expanded' }, with_context = false) }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't it be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bit trickier because we have 3 states: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I'm missing something, but doesn't this check will interpret any application path containing "/vendor/" as part of vendor code? I know my point is really border, but could we check if the path is really in the project's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although you are right, I'd prefer to ignore that edge case: having |
||
</div> | ||
{% endfor %} | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this work on Windows ?