Follow-up for Iba0138a6d: remove now-unused MWHookException class
[lhc/web/wiklou.git] / includes / exception / MWExceptionHandler.php
index d25f1a8..5734902 100644 (file)
@@ -380,10 +380,12 @@ TXT;
                                $text .= "{$pad}#{$level} [internal function]: ";
                        }
 
-                       if ( isset( $frame['class'] ) ) {
+                       if ( isset( $frame['class'] ) && isset( $frame['type'] ) && isset( $frame['function'] ) ) {
                                $text .= $frame['class'] . $frame['type'] . $frame['function'];
-                       } else {
+                       } elseif ( isset( $frame['function'] ) ) {
                                $text .= $frame['function'];
+                       } else {
+                               $text .= 'NO_FUNCTION_GIVEN';
                        }
 
                        if ( isset( $frame['args'] ) ) {
@@ -485,6 +487,14 @@ TXT;
                return "[$id] $url   $type from line $line of $file: $message";
        }
 
+       public static function getPublicLogMessage( Exception $e ) {
+               $logId = self::getLogId( $e );
+               $type = get_class( $e );
+               return '[' . $logId . '] '
+                       . gmdate( 'Y-m-d H:i:s' ) . ': '
+                       . 'Fatal exception of type ' . $type;
+       }
+
        /**
         * Get a PSR-3 log event context from an Exception.
         *