Refactored parser output handling slightly, and added a hook function, to allow exten...
[lhc/web/wiklou.git] / includes / Exception.php
index 027c5d3..696454d 100644 (file)
@@ -41,6 +41,13 @@ class MWException extends Exception
                }
        }
        
+       function getLogMessage() {
+               $file = $this->getFile();
+               $line = $this->getLine();
+               $message = $this->getMessage();
+               return "{$_SERVER['REQUEST_URI']} Exception from line $line of $file: $message";
+       }
+       
        function reportHTML() {
                global $wgOut;
                if ( $this->useOutputPage() ) {
@@ -68,6 +75,10 @@ class MWException extends Exception
                if ( $wgCommandLineMode ) {
                        $this->reportText();
                } else {
+                       $log = $this->getLogMessage();
+                       if ( $log ) {
+                               wfDebugLog( 'exception', $log );
+                       }
                        $this->reportHTML();
                }
        }
@@ -95,6 +106,7 @@ class MWException extends Exception
        function htmlFooter() {
                echo "</body></html>";
        }
+
 }
 
 /**