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 <vo...@hallowelt.biz>
Gerrit-Reviewer: Dvogel hallowelt <daniel.vo...@hallowelt.com>
Gerrit-Reviewer: Ljonka <l.verhovs...@gmail.com>
Gerrit-Reviewer: Mglaser <gla...@hallowelt.biz>
Gerrit-Reviewer: Pwirth <wi...@hallowelt.biz>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to