"\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString( $eNew );
} else {
$message .= "Exception caught inside exception handler.\n\n" .
- "Set \$wgShowExceptionDetails = true; at the bottom of LocalSettings.php " .
- "to show detailed debugging information.";
+ self::getShowBacktraceError( $e );
}
$message .= "\n";
} else {
$logId,
MWExceptionHandler::getURL()
) . "</div>\n" .
- "<!-- Set \$wgShowExceptionDetails = true; " .
- "at the bottom of LocalSettings.php to show detailed " .
- "debugging information. -->";
+ "<!-- " . wordwrap( self::getShowBacktraceError( $e ), 50 ) . " -->";
}
return $html;
"\nBacktrace:\n" .
MWExceptionHandler::getRedactedTraceAsString( $e ) . "\n";
} else {
- return "Set \$wgShowExceptionDetails = true; " .
- "in LocalSettings.php to show detailed debugging information.\n";
+ return self::getShowBacktraceError( $e );
}
}
);
}
+ /**
+ * @param Exception|Throwable $e
+ * @return string
+ */
+ private static function getShowBacktraceError( $e ) {
+ global $wgShowExceptionDetails, $wgShowDBErrorBacktrace;
+ $vars = [];
+ if ( !$wgShowExceptionDetails ) {
+ $vars[] = '$wgShowExceptionDetails = true;';
+ }
+ if ( $e instanceof DBError && !$wgShowDBErrorBacktrace ) {
+ $vars[] = '$wgShowDBErrorBacktrace = true;';
+ }
+ $vars = implode( ' and ', $vars );
+ return "Set $vars at the bottom of LocalSettings.php to show detailed debugging information";
+ }
+
/**
* @return bool
*/