From: Federico Leva
Date: Thu, 12 Feb 2015 23:01:54 +0000 (+0100)
Subject: Add i18n for the infamous "Fatal exception of type MWException" errorbox
X-Git-Tag: 1.31.0-rc.0~12284^2
X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/supprimer.php?a=commitdiff_plain;h=9f7d683fe5749791611faadb157290e6542c1a1a;p=lhc%2Fweb%2Fwiklou.git
Add i18n for the infamous "Fatal exception of type MWException" errorbox
These errors usually need to be reported, so it's better for the user
to understand them as much as possible.
Bug: T40095
Change-Id: Ibd2f984b66acb9150400126f21acf7cc5fc85acd
---
diff --git a/includes/exception/MWException.php b/includes/exception/MWException.php
index 6fd6fb5f25..097c0436ad 100644
--- a/includes/exception/MWException.php
+++ b/includes/exception/MWException.php
@@ -117,10 +117,11 @@ class MWException extends Exception {
$args = array_slice( func_get_args(), 2 );
if ( $this->useMessageCache() ) {
- return wfMessage( $key, $args )->text();
- } else {
- return wfMsgReplaceArgs( $fallback, $args );
+ try {
+ return wfMessage( $key, $args )->text();
+ } catch ( Exception $e ) {}
}
+ return wfMsgReplaceArgs( $fallback, $args );
}
/**
@@ -139,10 +140,17 @@ class MWException extends Exception {
nl2br( htmlspecialchars( MWExceptionHandler::getRedactedTraceAsString( $this ) ) ) .
"
\n";
} else {
+ $logId = MWExceptionHandler::getLogId( $this );
+ $type = get_class( $this );
return "" .
- '[' . MWExceptionHandler::getLogId( $this ) . '] ' .
- gmdate( 'Y-m-d H:i:s' ) .
- ": Fatal exception of type " . get_class( $this ) . "
\n" .
+ '[' . $logId . '] ' .
+ gmdate( 'Y-m-d H:i:s' ) . ": " .
+ $this->msg( "internalerror-fatal-exception",
+ "Fatal exception of type $1",
+ $type,
+ $logId,
+ MWExceptionHandler::getURL( $this )
+ ) . "\n" .
"";
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 96e3e3e67e..31c766fdb1 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -322,6 +322,7 @@
"readonly_lag": "The database has been automatically locked while the slave database servers catch up to the master",
"internalerror": "Internal error",
"internalerror_info": "Internal error: $1",
+ "internalerror-fatal-exception": "Fatal exception of type \"$1\"",
"filecopyerror": "Could not copy file \"$1\" to \"$2\".",
"filerenameerror": "Could not rename file \"$1\" to \"$2\".",
"filedeleteerror": "Could not delete file \"$1\".",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 9968cc921f..021b865156 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -486,6 +486,7 @@
"readonly_lag": "Error message displayed when the database is locked.",
"internalerror": "{{Identical|Internal error}}",
"internalerror_info": "Parameters:\n* $1 - error message",
+ "internalerror-fatal-exception": "Error message displayed by MediaWiki itself when the request failed, inside an error box which also contains a code, a timestamp and a colon before this message.\nParameters:\n* $1 - proper name of the kind of error\n* $2 - alphanumeric code identifying the error in the server logs\n* $3 - URL which resulted in the error\n$2 and $3 are not used by default and only available for wiki customisations, because they are useful for communication to the wiki system administrator.",
"filecopyerror": "Parameters:\n* $1 - source file name\n* $2 - destination file name",
"filerenameerror": "Parameters:\n* $1 - old file name\n* $2 - new file name",
"filedeleteerror": "Parameters:\n* $1 - file name",