Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4935
HideQuery.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 10:12 PM
2014-11-21 22:12:33 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
HideQuery.patch
View Options
Index: includes/api/ApiMain.php
===================================================================
--- includes/api/ApiMain.php (revision 36771)
+++ includes/api/ApiMain.php (working copy)
@@ -288,6 +288,7 @@
* Returns the error code
*/
protected function substituteResultWithError($e) {
+ global $wgShowSQLErrors, $wgShowExceptionDetails;
// Printer may not be initialized if the extractRequestParams() fails for the main module
if (!isset ($this->mPrinter)) {
@@ -317,11 +318,18 @@
//
// Something is seriously wrong
//
+ if ( ( $e instanceof DBQueryError ) && !$wgShowSQLErrors ) {
+ $info = "Database query error";
+ } else {
+ $info = "Exception Caught: {$e->getMessage()}";
+ }
+
$errMessage = array (
'code' => 'internal_api_error_'. get_class($e),
- 'info' => "Exception Caught: {$e->getMessage()}"
+ 'info' => $info
);
- ApiResult :: setContent($errMessage, "\n\n{$e->getTraceAsString()}\n\n");
+
+ ApiResult :: setContent($errMessage, $wgShowExceptionDetails ? "\n\n{$e->getTraceAsString()}\n\n" : "" );
}
$this->getResult()->reset();
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4499
Default Alt Text
HideQuery.patch (1 KB)
Attached To
Mode
T16678: API ignores $wgShowSQLErrors
Attached
Detach File
Event Timeline
Log In to Comment