r102581 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102580‎ | r102581 | r102582 >
Date:21:58, 9 November 2011
Author:jpostlethwaite
Status:ok
Tags:fundraising 
Comment:
Applying internal error handling to Gateway adapter.
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -799,15 +799,19 @@
800800 $this->executeIfFunctionExists( 'pre_process_' . $transaction );
801801
802802 if ( $this->getValidationAction() != 'process' ) {
803 - return array(
 803+
 804+ self::log( "Failed failed pre-process checks.", LOG_CRIT );
 805+
 806+ $this->transaction_results = array(
804807 'status' => false,
805 - //TODO: appropriate messages.
806 - 'message' => "$transaction : Failed failed pre-process checks. Somebody PLEASE override me!",
 808+ 'message' => $this->getErrorMapByCodeAndTranslate( 'internal-0000' ),
807809 'errors' => array(
808 - '1000000' => 'pre-process failed you.' //...stupid code.
 810+ 'internal-0000' => $this->getErrorMapByCodeAndTranslate( 'internal-0000' ),
809811 ),
810812 'action' => $this->getValidationAction(),
811813 );
 814+
 815+ return $this->getTransactionAllResults();
812816 }
813817
814818 //TODO: Maybe move this to the pre_process functions?
@@ -827,16 +831,19 @@
828832 $this->saveCommunicationStats( "buildRequestNameValueString", $transaction ); // save profiling data
829833 }
830834 } catch ( MWException $e ) {
 835+
831836 self::log( "Malformed gateway definition. Cannot continue: Aborting.\n" . $e->getMessage(), LOG_CRIT );
832 - return array(
 837+
 838+ $this->transaction_results = array(
833839 'status' => false,
834 - //TODO: appropriate messages.
835 - 'message' => "$transaction : Malformed gateway definition. Cannot continue: Aborting.\n" . $e->getMessage(),
 840+ 'message' => $this->getErrorMapByCodeAndTranslate( 'internal-0001' ),
836841 'errors' => array(
837 - '1000000' => 'Transaction could not be processed due to an internal error.'
 842+ 'internal-0001' => $this->getErrorMapByCodeAndTranslate( 'internal-0001' ),
838843 ),
839844 'action' => $this->getValidationAction(),
840845 );
 846+
 847+ return $this->getTransactionAllResults();
841848 }
842849
843850 //start looping here, if we're the sort of transaction that needs to do that.
@@ -892,14 +899,19 @@
893900 $this->saveCommunicationStats( __FUNCTION__, $transaction, "counter = $counter" );
894901
895902 if ( $txn_ok === false ) { //nothing to process, so we have to build it manually
896 - return array(
 903+
 904+ self::log( "$transaction Communication Failed!", LOG_CRIT );
 905+
 906+ $this->transaction_results = array(
897907 'status' => false,
898 - 'message' => "$transaction Communication Failed!",
 908+ 'message' => $this->getErrorMapByCodeAndTranslate( 'internal-0002' ),
899909 'errors' => array(
900 - '1000000' => 'communication failure' //...stupid code.
 910+ 'internal-0002' => $this->getErrorMapByCodeAndTranslate( 'internal-0002' ),
901911 ),
902912 'action' => $this->getValidationAction(),
903913 );
 914+
 915+ return $this->getTransactionAllResults();
904916 }
905917
906918 //If we have any special post-process instructions for this

Follow-up revisions

RevisionCommit summaryAuthorDate
r102842MFT r102576, r102577, r102579, r102581, r102804, r102805, r102812, r102819, r...awjrichards02:20, 12 November 2011
r102929Re-attempting MFT r102576, r102577, r102578, r102579, r102581, r102689, r1027...khorn00:50, 14 November 2011

Status & tagging log