? Success

User tests: Successful: Unsuccessful:

avatar asika32764
asika32764
1 Dec 2013

Introduction

In current time, we use setError(), getError() and JError::raiseError() in component to send error message.

However, if we use Exception to throw error, the debug plugin will not render backtrace for developer. It only work when we use JError::reiseError().

It's because we have this code: 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.

The Modification

I added backtrace table in isis error.php, this code are consult from JDocumentError::renderBacktrace(), but I dont' use this method because it rendered a table without bootstrap table style.

So I wrote backtrace renderer in isis to support Bootstrap style. I dont't want to change JDocumentError, because it is a Platform class not CMS class.

Screenshot

p2013-12-01-3

JTracker: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32854&start=0

avatar asika32764 asika32764 - open - 1 Dec 2013
avatar asika32764 asika32764 - change - 1 Dec 2013
The description was changed
Title
Add render backtrace in isis template with bootstrap style
[#32854] Add render backtrace in isis template with bootstrap style
Description <h2>Introduction</h2> <p>In current time, we use <code>setError()</code>, <code>geetError()</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">-&gt;</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 exception, <code>JError::getErrors()</code> will return null.</p> <h2>The Modification</h2> <p>I added backtrace table in isis <code>error.php</code>, this code are consult <code>JDocumentError::renderBacktrace()</code>, but I dont' use this method because it rendered a table without bootstrap table style.</p> <p>So I wrote backtrace renderer in isis to support Bootstrap style. I dont't want to change <code>JDocumentError</code>, because it is a Platform class not CMS class.</p> <h2>Screenshot</h2> <p><a href="https://f.cloud.github.com/assets/1639206/1650232/eb7e84cc-5a73-11e3-996e-81446b8b5845.jpg" target="_blank"><img src="https://f.cloud.github.com/assets/1639206/1650232/eb7e84cc-5a73-11e3-996e-81446b8b5845.jpg" alt="p2013-12-01-3" style="max-width:100%;"></a></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">-&gt;</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 table in isis <code>error.php</code>, this code are consult from <code>JDocumentError::renderBacktrace()</code>, but I dont' use this method because it rendered a table without bootstrap table style.</p> <p>So I wrote backtrace renderer in isis to support Bootstrap style. I dont't want to change <code>JDocumentError</code>, because it is a Platform class not CMS class.</p> <h2>Screenshot</h2> <p><a href="https://f.cloud.github.com/assets/1639206/1650232/eb7e84cc-5a73-11e3-996e-81446b8b5845.jpg" target="_blank"><img src="https://f.cloud.github.com/assets/1639206/1650232/eb7e84cc-5a73-11e3-996e-81446b8b5845.jpg" alt="p2013-12-01-3" style="max-width:100%;"></a></p> <p>JTracker: <a href="http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=32854&amp;start=0">http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=32854&amp;start=0</a></p>
Labels Added: ?
avatar brunobatista
brunobatista - comment - 1 Dec 2013

:+1:

avatar beat
beat - comment - 1 Dec 2013

Nice feature :+1: . Please use same method as the debug plugin does for the backtraces on SQL queries: There is already code for that, with the premium advantage that files can be clickable to open the line in the IDE directly (+benefit of single point of maintenance).

avatar asika32764
asika32764 - comment - 1 Dec 2013

Thanks. @beat Do you mean using PlgSystemDebug::renderBacktrace() in isis? I'm not sure which method you mean and should we using plugin method in template?

Or there has another renderBacktrace() in a class that I can use it?

avatar asika32764 asika32764 - change - 14 Jun 2014
Description <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">-&gt;</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 table in isis <code>error.php</code>, this code are consult from <code>JDocumentError::renderBacktrace()</code>, but I dont' use this method because it rendered a table without bootstrap table style.</p> <p>So I wrote backtrace renderer in isis to support Bootstrap style. I dont't want to change <code>JDocumentError</code>, because it is a Platform class not CMS class.</p> <h2>Screenshot</h2> <p><a href="https://f.cloud.github.com/assets/1639206/1650232/eb7e84cc-5a73-11e3-996e-81446b8b5845.jpg" target="_blank"><img src="https://f.cloud.github.com/assets/1639206/1650232/eb7e84cc-5a73-11e3-996e-81446b8b5845.jpg" alt="p2013-12-01-3" style="max-width:100%;"></a></p> <p>JTracker: <a href="http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=32854&amp;start=0">http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=32854&amp;start=0</a></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">-&gt;</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 table in isis <code>error.php</code>, this code are consult from <code>JDocumentError::renderBacktrace()</code>, but I dont' use this method because it rendered a table without bootstrap table style.</p> <p>So I wrote backtrace renderer in isis to support Bootstrap style. I dont't want to change <code>JDocumentError</code>, because it is a Platform class not CMS class.</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>JTracker: <a href="http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=32854&amp;start=0">http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=32854&amp;start=0</a></p>
avatar asika32764
asika32764 - comment - 14 Jun 2014

Re create a new PR to staging in #3780

avatar asika32764 asika32764 - change - 14 Jun 2014
Title
[#32854] Add render backtrace in isis template with bootstrap style
[#32854] Use JLayout to render debug backtrace
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-06-14 14:57:49
avatar asika32764 asika32764 - close - 14 Jun 2014

Add a Comment

Login with GitHub to post a comment