Mailing List Archive

[MediaWiki-commits] [Gerrit] mediawiki...Flow[master]: OptInController catch both errors and exception
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 <sbisson@wikimedia.org>

_______________________________________________
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 [ In reply to ]
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 <sbisson@wikimedia.org>
Gerrit-Reviewer: Catrope <roan@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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