]> source.dussan.org Git - nextcloud-server.git/commitdiff
Only display call trace in debug mode
authorBart Visscher <bartv@thisnet.nl>
Sun, 21 Jul 2013 20:56:21 +0000 (22:56 +0200)
committerBart Visscher <bartv@thisnet.nl>
Sun, 21 Jul 2013 20:56:21 +0000 (22:56 +0200)
lib/template.php

index d48e3b36821c4ea67b7f83eff37b5f0a342df288..2b94fb6725ca26f8b6bb4814c27969319a69d264 100644 (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>';
+                       }
+                       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();
                        }
-                       $error_msg .= $exception->getMessage();
-               };
+               }
                self::printErrorPage($error_msg, $hint);
        }
 }