User tests: Successful: Unsuccessful:
This is same as #2626 but direct to staging
branch.
In current time, we use setError()
, getError()
and JError::raiseError()
in component to send error message.
However, if we use throw Exception
, the debug plugin will not render backtrace for developer. It only work when we use JError::raiseError()
.
It's because we have this code in: https://github.com/joomla/joomla-cms/blob/master/plugins/system/debug/debug.php#L213
if (JDEBUG)
{
if (JError::getErrors())
{
$html[] = $this->display('errors');
}
To detect whether display errors or not. When we throw an exception, the JError::getErrors()
will return null that backtrace will not rendered.
I added backtrace layout in layouts/error/backtrace.php
and now, debug plugin & isis template both include this layout. It will help developers know how errors occurred.
Global Configuration
, enable the debug mode.index.php?option=foo
in browser, you will see the error page.Description | <p>This is same as <a href="https://github.com/joomla/joomla-cms/pull/2626" class="issue-link" title="[#32854] Use JLayout to render debug backtrace">#2626</a> but direct to <code>staging</code> branch.</p> <h2>Introduction</h2> <p>In current time, we use <code>setError()</code>, <code>getError()</code> and <code>JError::raiseError()</code> in component to send error message.</p> <p>However, if we use <code>Exception</code> to throw error, the debug plugin will not render backtrace for developer. It only work when we use <code>JError::reiseError()</code>.</p> <p>It's because we have this code: <a href="https://github.com/joomla/joomla-cms/blob/master/plugins/system/debug/debug.php#L213">https://github.com/joomla/joomla-cms/blob/master/plugins/system/debug/debug.php#L213</a></p> <div class="highlight highlight-php"><pre><span class="k">if</span> <span class="p">(</span><span class="nx">JDEBUG</span><span class="p">)</span> <span class="p">{</span> <span class="k">if</span> <span class="p">(</span><span class="nx">JError</span><span class="o">::</span><span class="na">getErrors</span><span class="p">())</span> <span class="p">{</span> <span class="nv">$html</span><span class="p">[]</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">display</span><span class="p">(</span><span class="s1">'errors'</span><span class="p">);</span> <span class="p">}</span> </pre></div> <p>To detect whether display errors or not. When we throw an exception, the <code>JError::getErrors()</code> will return null.</p> <h2>The Modification</h2> <p>I added backtrace layout in <code>layouts/error/backtrace.php</code> and now, debug plugin & isis template both include this layout. It will help developers know how errors occurred.</p> <h2>Screenshot</h2> <p><a href="https://camo.githubusercontent.com/07e0816bfcb9e023158219e07fdfa9e1aa9733b0/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313633393230362f313635303233322f65623765383463632d356137332d313165332d393936652d3831343436623862353834352e6a7067" target="_blank"><img src="https://camo.githubusercontent.com/07e0816bfcb9e023158219e07fdfa9e1aa9733b0/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313633393230362f313635303233322f65623765383463632d356137332d313165332d393936652d3831343436623862353834352e6a7067" alt="p2013-12-01-3" data-canonical-src="https://f.cloud.github.com/assets/1639206/1650232/eb7e84cc-5a73-11e3-996e-81446b8b5845.jpg" style="max-width:100%;"></a></p> <p><a href="https://cloud.githubusercontent.com/assets/1639206/3278790/fcf7423a-f3d3-11e3-83da-e5b952a5464c.jpg" target="_blank"><img src="https://cloud.githubusercontent.com/assets/1639206/3278790/fcf7423a-f3d3-11e3-83da-e5b952a5464c.jpg" alt="p-2014-06-14-3" style="max-width:100%;"></a></p> <p>JTracker: <a href="http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32854&start=0">http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32854&start=0</a></p> | ⇒ | <p>This is same as <a href="https://github.com/joomla/joomla-cms/pull/2626" class="issue-link" title="[#32854] Use JLayout to render debug backtrace">#2626</a> but direct to <code>staging</code> branch.</p> <h2>Introduction</h2> <p>In current time, we use <code>setError()</code>, <code>getError()</code> and <code>JError::raiseError()</code> in component to send error message.</p> <p>However, if we use throw <code>Exception</code>, the debug plugin will not render backtrace for developer. It only work when we use <code>JError::raiseError()</code>.</p> <p>It's because we have this code in: <a href="https://github.com/joomla/joomla-cms/blob/master/plugins/system/debug/debug.php#L213">https://github.com/joomla/joomla-cms/blob/master/plugins/system/debug/debug.php#L213</a></p> <div class="highlight highlight-php"><pre><span class="k">if</span> <span class="p">(</span><span class="nx">JDEBUG</span><span class="p">)</span> <span class="p">{</span> <span class="k">if</span> <span class="p">(</span><span class="nx">JError</span><span class="o">::</span><span class="na">getErrors</span><span class="p">())</span> <span class="p">{</span> <span class="nv">$html</span><span class="p">[]</span> <span class="o">=</span> <span class="nv">$this</span><span class="o">-></span><span class="na">display</span><span class="p">(</span><span class="s1">'errors'</span><span class="p">);</span> <span class="p">}</span> </pre></div> <p>To detect whether display errors or not. When we throw an exception, the <code>JError::getErrors()</code> will return null that backtrace will not rendered.</p> <h2>The Modification</h2> <p>I added backtrace layout in <code>layouts/error/backtrace.php</code> and now, debug plugin & isis template both include this layout. It will help developers know how errors occurred.</p> <h2>How to Test</h2> <ol class="task-list"> <li>Go to <code>Global Configuration</code>, enable the debug mode.</li> <li>Then type <code>index.php?option=foo</code> in browser, you will see the error page.</li> </ol><h2>Screenshot</h2> <p><a href="https://camo.githubusercontent.com/07e0816bfcb9e023158219e07fdfa9e1aa9733b0/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313633393230362f313635303233322f65623765383463632d356137332d313165332d393936652d3831343436623862353834352e6a7067" target="_blank"><img src="https://camo.githubusercontent.com/07e0816bfcb9e023158219e07fdfa9e1aa9733b0/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313633393230362f313635303233322f65623765383463632d356137332d313165332d393936652d3831343436623862353834352e6a7067" alt="p2013-12-01-3" data-canonical-src="https://f.cloud.github.com/assets/1639206/1650232/eb7e84cc-5a73-11e3-996e-81446b8b5845.jpg" style="max-width:100%;"></a></p> <p><a href="https://cloud.githubusercontent.com/assets/1639206/3278790/fcf7423a-f3d3-11e3-83da-e5b952a5464c.jpg" target="_blank"><img src="https://cloud.githubusercontent.com/assets/1639206/3278790/fcf7423a-f3d3-11e3-83da-e5b952a5464c.jpg" alt="p-2014-06-14-3" style="max-width:100%;"></a></p> <p>JTracker: <a href="http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32854&start=0">http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32854&start=0</a></p> |
I'm not sure where should I move up my code to?
I rebased it on staging. Is this helpful for test?
It would be excellent to rebase on staging. However looking at the PR it looks like you did something wrong when you rebased. The PR should only contain your changes but now contains several others.
Oh yes, when I rebasing my branch, I miss some old commit on my repo, so when I merged it and force pushed, the origin branch has missed and this wrong copy instead. I found this after I pushed it.
@asika32764 This PR still has issues when I want to apply it.
error: patch failed: administrator/components/com_joomlaupdate/models/default.php:284
error: administrator/components/com_joomlaupdate/models/default.php: patch does not apply
error: patch failed: libraries/cms/html/email.php:45
error: libraries/cms/html/email.php: patch does not apply
It seems there are now files changed that are not part of the original PR. Check the file list in the original PR, it is different from this PR. Thanks.
Soft reset and re commit my files. Hop this works.
@asika32764 We are almost there :) The PR applies fine now but I am missing something. The second image you posted shows the call stack in the Joomla! Debug Console. I don't see that after applying the PR, maybe a file is missed?
In addition I have a request to make the location links clickable for XDebug as is done already in the debug plugin:
https://github.com/joomla/joomla-cms/blob/staging/plugins/system/debug/debug.php#L125
Thanks.
Status | New | ⇒ | Pending |
Labels |
Removed:
?
|
Category | ⇒ | Layout |
I think this is a good idea. I also think this could be a good time to look at tying in the Framework's enhanced profiler package and deprecating JProfiler (I did it at 3.5-dev...mbabker:Profiler but it admittedly doesn't account for all B/C concerns) as it should improve the internal data structure of the profiler data and split out some of the behavioral logic that's contained in JProfiler. Also the missing stack trace for the template is fixed with #6621 so that can be pulled out of this PR.
@asika32764 Can you take a look at my feedback?
@mbabker Do you mean that Asika should look at improving this PR with the proposed changes you did in the diff you linked?
Mostly thinking out loud. The Framework's Profiler package has a better API for splitting the different concerns of JProfiler and in theory gives anyone using it a bit more flexibility with rendering data. But not a requirement for this PR to be accepted
Sorry I'm too busy to continue finish this PR this year. And I am using new computer now, I have to re-clone Joomla to do this stuff. Could anyone take over this? or waiting for me to find a time to do this.
@asika32764 Thank you for your reply. I will try to find someone to take this over.
Thank you for creating this. It’s been some time since you created this and it looks like there is no one interested in taking this over. It can always be reopened if that happens
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-05-08 08:53:53 |
Closed_By | ⇒ | brianteeman |
@asika32764 Can you please check the PR as it has an error in the file administrator/templates/isis/error.php as it has changed. Your change needs to be moved up a few lines. After that I can test it, thanks.