User tests: Successful: Unsuccessful:
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.
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.
Title |
|
||||||
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">-></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">-></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&tracker_item_id=32854&start=0">http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32854&start=0</a></p> | ||||
Labels |
Added:
?
|
Nice feature . 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).
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">-></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&tracker_item_id=32854&start=0">http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32854&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">-></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&tracker_item_id=32854&start=0">http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32854&start=0</a></p> |
Title |
|
||||||
Status | New | ⇒ | Closed | ||||
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-06-14 14:57:49 |