[MediaWiki-commits] [Gerrit] mediawiki...Flow[master]: OptInController catch both errors and exception

2018-01-24 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/406051 )

Change subject: OptInController catch both errors and exception
..


OptInController catch both errors and exception

The problem that is currently causing the opt-out to
fail is not an Exception but an Error. Catching Throwable
to make sure we revert the transations in all cases.

Bug: T184670
Change-Id: Id0f4271d635094bf99f2fc8fa9cbbc4b08f07b46
---
M includes/Import/OptInController.php
1 file changed, 5 insertions(+), 5 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Import/OptInController.php 
b/includes/Import/OptInController.php
index 49d9e84..c79f58d 100644
--- a/includes/Import/OptInController.php
+++ b/includes/Import/OptInController.php
@@ -6,7 +6,6 @@
 use DateTimeZone;
 use DeferredUpdates;
 use DerivativeContext;
-use Exception;
 use Flow\DbFactory;
 use Flow\Collection\HeaderCollection;
 use Flow\Content\BoardContent;
@@ -124,18 +123,19 @@
} else {
$logger->error( 
$outerMethod . ': unrecognized action: ' . $action );
}
-   } catch ( Exception $e ) {
+   } catch ( \Throwable $t ) {
$logger->error(
-   $outerMethod . 
' failed to {action} Flow on \'{talkpage}\' for user \'{user}\'.  Exception: 
{exception}',
+   $outerMethod . 
' failed to {action} Flow on \'{talkpage}\' for user \'{user}\'. {message} 
{trace}',
[

'action' => $action,

'talkpage' => $talkpage,
'user' 
=> $user,
-   
'exception' => $e,
+   
'message' => $t->getMessage(),
+   'trace' 
=> $t->getTraceAsString(),
]
);
// rollback both Flow 
and Core DBs
-   
MWExceptionHandler::rollbackMasterChangesAndLog( $e );
+   
MWExceptionHandler::rollbackMasterChangesAndLog( $t );

$this->dbFactory->getDB( DB_MASTER )->rollback( $outerMethod );
}
},

-- 
To view, visit https://gerrit.wikimedia.org/r/406051
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id0f4271d635094bf99f2fc8fa9cbbc4b08f07b46
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Sbisson 
Gerrit-Reviewer: Catrope 
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...Flow[master]: OptInController catch both errors and exception

2018-01-24 Thread Sbisson (Code Review)
Sbisson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/406051 )

Change subject: OptInController catch both errors and exception
..

OptInController catch both errors and exception

The problem that is currently causing the opt-out to
fail is not an Exception but an Error. Catching Throwable
to make sure we revert the transations in all cases.

Bug: T184670
Change-Id: Id0f4271d635094bf99f2fc8fa9cbbc4b08f07b46
---
M includes/Import/OptInController.php
1 file changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/51/406051/1

diff --git a/includes/Import/OptInController.php 
b/includes/Import/OptInController.php
index 49d9e84..5499036 100644
--- a/includes/Import/OptInController.php
+++ b/includes/Import/OptInController.php
@@ -124,18 +124,19 @@
} else {
$logger->error( 
$outerMethod . ': unrecognized action: ' . $action );
}
-   } catch ( Exception $e ) {
+   } catch ( \Throwable $t ) {
$logger->error(
-   $outerMethod . 
' failed to {action} Flow on \'{talkpage}\' for user \'{user}\'.  Exception: 
{exception}',
+   $outerMethod . 
' failed to {action} Flow on \'{talkpage}\' for user \'{user}\'. {message} 
{trace}',
[

'action' => $action,

'talkpage' => $talkpage,
'user' 
=> $user,
-   
'exception' => $e,
+   
'message' => $t->getMessage(),
+   'trace' 
=> $t->getTraceAsString(),
]
);
// rollback both Flow 
and Core DBs
-   
MWExceptionHandler::rollbackMasterChangesAndLog( $e );
+   
MWExceptionHandler::rollbackMasterChangesAndLog( $t );

$this->dbFactory->getDB( DB_MASTER )->rollback( $outerMethod );
}
},

-- 
To view, visit https://gerrit.wikimedia.org/r/406051
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0f4271d635094bf99f2fc8fa9cbbc4b08f07b46
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Sbisson 

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