I am developing an extension for MediaWiki 1.16 in the form of an API extension. I’m using the database access function wfGetDB but I find it hard to debug because the full error messages are not displayed even by including the following lines in LocalSettings.php:
error_reporting( E_ALL );
ini_set('display_errors', 1);
//... rest of the file ...
$wgShowExceptionDetails = true;
Here is an example of the stack I get:
#0 /srv/www/htdocs/wotp/cd/includes/db/Database.php(538): DatabaseBase->reportQueryError('Unknown column ...', 1054, 'SELECT languag...', 'cdDictList::exe...', false)
#1 /srv/www/htdocs/wotp/cd/includes/db/Database.php(874): DatabaseBase->query('SELECT languag...', 'cdDictList::exe...')
#2 /srv/www/htdocs/wotp/cd/extensions/CommunityDictionary/includes/cdDictList.class.php(30): DatabaseBase->select('user_dictionary...', Array, Array, 'cdDictList::exe...', Array, Array)
#3 /srv/www/htdocs/wotp/cd/includes/api/ApiMain.php(595): cdDictList->execute()
#4 /srv/www/htdocs/wotp/cd/includes/api/ApiMain.php(338): ApiMain->executeAction()
#5 /srv/www/htdocs/wotp/cd/includes/api/ApiMain.php(322): ApiMain->executeActionWithErrorHandling()
#6 /srv/www/htdocs/wotp/cd/api.php(115): ApiMain->execute()
#7 {main}
Is there a way to know what is hiding behind the ... so I can know which column is unknown for example?
I found the answer myself. Here is the code to catch the exception and display it:
The error then comes in this form: