2011-12-17 4 views
1

MediaWiki 1.16 확장 프로그램을 API 확장 형식으로 개발 중입니다. 나는 데이터베이스 액세스 기능 wfGetDB를 사용하고 있지만 전체 오류 메시지가 표시되지 않기 때문에 열심히도 LocalSettings.php에서 다음 줄을 포함하여 디버깅을 찾을 : 여기 전체 오류 설명 표시

error_reporting(E_ALL); 
ini_set('display_errors', 1); 
//... rest of the file ... 
$wgShowExceptionDetails = true; 

내가 얻을 스택의 예입니다 :

#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} 

그래서 예를 들어 알 수있는 열을 알 수 ... 뒤에 숨어 있는지 알 수있는 방법이 있나요?

답변

1

직접 답변을 찾았습니다. 여기에 예외를 catch하고 표시하는 코드는 다음과 같습니다

오류는 다음이 형태로 제공
try{ 
    $result = $this -> dbr -> select(...select code here...); 
} 
catch (Exception $e){ 
    error_log($e->getMessage()); 
    ApiBase :: dieDebug(__METHOD__, $e->getMessage()); 
} 

:

<error code="internal_api_error_MWException" info="error text">