[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceFoundation[master]: BSApiTasksBase: Added exception handling
Pwirth has submitted this change and it was merged. Change subject: BSApiTasksBase: Added exception handling .. BSApiTasksBase: Added exception handling Catching exceptions from the task-methods ourselfs allows us to respond in our preferred format instead of having default MediaWiki-API-Exception format. This also reduces code in the subclasses Change-Id: Ib3bd728e79648d4a6d8ce713463f40632df2057b --- M includes/api/BSApiTasksBase.php 1 file changed, 6 insertions(+), 1 deletion(-) Approvals: Pwirth: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/api/BSApiTasksBase.php b/includes/api/BSApiTasksBase.php index b0a2a7e..3e51ef8 100644 --- a/includes/api/BSApiTasksBase.php +++ b/includes/api/BSApiTasksBase.php @@ -101,7 +101,12 @@ $oResult = $this->validateTaskData( $oTaskData ); if( empty( $oResult->errors ) && empty( $oResult->message ) ) { - $oResult = $this->$sMethod( $oTaskData , $aParams ); + try { + $oResult = $this->$sMethod( $oTaskData , $aParams ); + } + catch ( Exception $e ) { + $oResult->message = $e->getMessage(); + } } Hooks::run( 'BSApiTasksBaseAfterExecuteTask', array( $this, $sTask, &$oResult, $oTaskData , $aParams ) ); -- To view, visit https://gerrit.wikimedia.org/r/311934 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib3bd728e79648d4a6d8ce713463f40632df2057b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation Gerrit-Branch: master Gerrit-Owner: Robert Vogel Gerrit-Reviewer: Dvogel hallowelt Gerrit-Reviewer: Ljonka Gerrit-Reviewer: Mglaser Gerrit-Reviewer: Pwirth Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...BlueSpiceFoundation[master]: BSApiTasksBase: Added exception handling
Robert Vogel has uploaded a new change for review. https://gerrit.wikimedia.org/r/311934 Change subject: BSApiTasksBase: Added exception handling .. BSApiTasksBase: Added exception handling Catching exceptions from the task-methods ourselfs allows us to respond in our preferred format instead of having default MediaWiki-API-Exception format. This also reduces code in the subclasses Change-Id: Ib3bd728e79648d4a6d8ce713463f40632df2057b --- M includes/api/BSApiTasksBase.php 1 file changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation refs/changes/34/311934/1 diff --git a/includes/api/BSApiTasksBase.php b/includes/api/BSApiTasksBase.php index b0a2a7e..3e51ef8 100644 --- a/includes/api/BSApiTasksBase.php +++ b/includes/api/BSApiTasksBase.php @@ -101,7 +101,12 @@ $oResult = $this->validateTaskData( $oTaskData ); if( empty( $oResult->errors ) && empty( $oResult->message ) ) { - $oResult = $this->$sMethod( $oTaskData , $aParams ); + try { + $oResult = $this->$sMethod( $oTaskData , $aParams ); + } + catch ( Exception $e ) { + $oResult->message = $e->getMessage(); + } } Hooks::run( 'BSApiTasksBaseAfterExecuteTask', array( $this, $sTask, &$oResult, $oTaskData , $aParams ) ); -- To view, visit https://gerrit.wikimedia.org/r/311934 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib3bd728e79648d4a6d8ce713463f40632df2057b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation Gerrit-Branch: master Gerrit-Owner: Robert Vogel ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits