Only display call trace in debug mode

This commit is contained in:
Bart Visscher 2013-07-21 22:56:21 +02:00
parent aa22194a09
commit 25e3c9cbeb
1 changed files with 17 additions and 10 deletions

View File

@ -531,17 +531,24 @@ class OC_Template{
if ($exception->getCode()) {
$error_msg = '['.$exception->getCode().'] '.$error_msg;
}
$hint = $exception->getTraceAsString();
if (!empty($hint)) {
$hint = '<pre>'.$hint.'</pre>';
}
while (method_exists($exception,'previous') && $exception = $exception->previous()) {
$error_msg .= '<br/>Caused by: ';
if ($exception->getCode()) {
$error_msg .= '['.$exception->getCode().'] ';
if (defined('DEBUG') and DEBUG) {
$hint = $exception->getTraceAsString();
if (!empty($hint)) {
$hint = '<pre>'.$hint.'</pre>';
}
$error_msg .= $exception->getMessage();
};
while (method_exists($exception,'previous') && $exception = $exception->previous()) {
$error_msg .= '<br/>Caused by: ';
if ($exception->getCode()) {
$error_msg .= '['.$exception->getCode().'] ';
}
$error_msg .= $exception->getMessage();
};
} else {
$hint = '';
if ($exception instanceof \OC\HintException) {
$hint = $exception->getHint();
}
}
self::printErrorPage($error_msg, $hint);
}
}