Adamw has uploaded a new change for review.
https://gerrit.wikimedia.org/r/94087
Change subject: WIP shutdown handler
......................................................................
WIP shutdown handler
Change-Id: Ibf7a8ad3aab43ba59f43ab2e69135e60034ae878
TODO: distinguish handled and unhandled, maybe this === fatal vs non-fatal
---
M Core/Http/RequestHandler.php
1 file changed, 8 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig
refs/changes/87/94087/1
diff --git a/Core/Http/RequestHandler.php b/Core/Http/RequestHandler.php
index fff540f..3f9bc6a 100644
--- a/Core/Http/RequestHandler.php
+++ b/Core/Http/RequestHandler.php
@@ -64,6 +64,7 @@
set_error_handler(
'\SmashPig\Core\Http\RequestHandler::lastChanceErrorHandler' );
set_exception_handler(
'\SmashPig\Core\Http\RequestHandler::lastChanceExceptionHandler' );
+
register_shutdown_function("\SmashPig\Core\Http\RequestHandler::shutdownHandler");
// Check to make sure there's even a point to continuing
if ( !$config->nodeExists( "endpoints/$action" ) ) {
@@ -94,6 +95,13 @@
return $response;
}
+ public static function shutdownHandler() {
+ $lastError = error_get_last();
+ if ( $lastError and $lastError['type'] === E_ERROR ) {
+ Logger::info("Fatal error caught by shutdown handler.
({$lastError['type']}) {$lastError['message']} @
{$lastError['file']}:{$lastError['line']}");
+ }
+ }
+
public static function lastChanceErrorHandler( $errno, $errstr,
$errfile = 'Unknown File',
$errline = 'Unknown Line', $errcontext = null
) {
--
To view, visit https://gerrit.wikimedia.org/r/94087
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf7a8ad3aab43ba59f43ab2e69135e60034ae878
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Adamw <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits