Skip to content
Extraits de code Groupes Projets
Valider e4857814 rédigé par mattab's avatar mattab
Parcourir les fichiers

Remove the ResponseBuilder flag and instead use the existing PIWIK_PRINT_ERROR_BACKTRACE

parent f2e5c906
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 17 ajouts et 23 suppressions
......@@ -22,8 +22,6 @@ use Piwik\DataTable;
*/
class ResponseBuilder
{
const DISPLAY_BACKTRACE_DEBUG = false;
private $request = null;
private $outputFormat = null;
......@@ -162,12 +160,10 @@ class ResponseBuilder
{
// If we are in tests, show full backtrace
if (defined('PIWIK_PATH_TEST_TO_ROOT')) {
if (self::DISPLAY_BACKTRACE_DEBUG
|| \Piwik_ShouldPrintBackTraceWithMessage()
) {
if (\Piwik_ShouldPrintBackTraceWithMessage()) {
$message = $e->getMessage() . " in \n " . $e->getFile() . ":" . $e->getLine() . " \n " . $e->getTraceAsString();
} else {
$message = $e->getMessage() . "\n \n --> To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in " . basename(__FILE__);
$message = $e->getMessage() . "\n \n --> To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php";
}
return new Exception($message);
}
......
......@@ -71,8 +71,7 @@ if (!function_exists('Piwik_ExitWithMessage')) {
function Piwik_ShouldPrintBackTraceWithMessage()
{
$bool = (defined('PIWIK_PRINT_ERROR_BACKTRACE') && PIWIK_PRINT_ERROR_BACKTRACE)
|| (defined('PIWIK_TRACKER_DEBUG') && PIWIK_TRACKER_DEBUG)
|| \Piwik\API\ResponseBuilder::DISPLAY_BACKTRACE_DEBUG;
|| (defined('PIWIK_TRACKER_DEBUG') && PIWIK_TRACKER_DEBUG);
return $bool;
}
......
Subproject commit c9edd879003ca7a9f75d81fe07ec6ff0c2340f91
Subproject commit a1125e96827e12c7bd5c3d6107b9c162aace32f8
......@@ -88,8 +88,7 @@ class ReleaseCheckListTest extends PHPUnit_Framework_TestCase
require_once PIWIK_INCLUDE_PATH . "/core/TaskScheduler.php";
$this->assertFalse(DEBUG_FORCE_SCHEDULED_TASKS);
require_once PIWIK_INCLUDE_PATH . "/core/API/ResponseBuilder.php";
$this->assertFalse(\Piwik\API\ResponseBuilder::DISPLAY_BACKTRACE_DEBUG);
$this->assertFalse(PIWIK_PRINT_ERROR_BACKTRACE);
}
private function _checkEqual($key, $valueExpected)
......
......@@ -29,7 +29,7 @@ class Core_LogTest extends DatabaseTestCase
public static $expectedExceptionOutput = array(
'screen' => 'dummy error message<br />
<br />
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php',
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php',
'file' => '[Core_LogTest] LogTest.php(161): dummy error message
dummy backtrace',
'database' => '[Core_LogTest] LogTest.php(161): dummy error message
......
......@@ -2,5 +2,5 @@
<result>
<error message="Please specify a value for 'label'.
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
\ No newline at end of file
......@@ -2,5 +2,5 @@
<result>
<error message="NoDataForAction
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
\ No newline at end of file
......@@ -2,5 +2,5 @@
<result>
<error message="NoDataForAction
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
\ No newline at end of file
......@@ -2,5 +2,5 @@
<result>
<error message="NoDataForAction
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
\ No newline at end of file
......@@ -2,5 +2,5 @@
<result>
<error message="NoDataForAction
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
\ No newline at end of file
......@@ -2,5 +2,5 @@
<result>
<error message="Row evolutions can not be processed with this combination of \'date\' and \'period\' parameters.
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
\ No newline at end of file
......@@ -3,5 +3,5 @@
<error message="Requested report Goals.get for Website id=1 not found in the list of available reports.
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
\ No newline at end of file
......@@ -2,5 +2,5 @@
<result>
<error message="Referrers.getAll with multiple sites or dates is not supported (yet).
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
\ No newline at end of file
......@@ -2,5 +2,5 @@
<result>
<error message="Referrers.getAll with multiple sites or dates is not supported (yet).
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
\ No newline at end of file
......@@ -2,5 +2,5 @@
<result>
<error message="VisitTime.getByDayOfWeek does not support multiple dates.
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
\ No newline at end of file
......@@ -2,5 +2,5 @@
<result>
<error message="VisitTime.getByDayOfWeek does not support multiple dates.
--&gt; To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in ResponseBuilder.php" />
--&gt; To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php" />
</result>
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter