Invoked on shutdown to attempt to capture any unhandled errors.
338029
public function onShutdown()
    {
        $error = error_get_last();
        if ($error !== null) {
            $errors = array(
                E_ERROR,
                E_PARSE,
                E_CORE_ERROR,
                E_CORE_WARNING,
                E_COMPILE_ERROR,
                E_COMPILE_WARNING,
                E_STRICT
            );
            if (in_array($error['type'], $errors)) {
                $this->getSentryClient()->captureException(
                    $this->createErrorException($error['message'], $error['type'], $error['file'], $error['line'])
                );
            }
        }
    }
1282561
def _shutdown(self, message=None, code=0):
        """"""
        if self._shutdown_complete:
            # Make sure we don't accidentally re-run the all cleanup
            sys.exit(code)

        if self.shutdown_callback is not None:
            # Call the shutdown callback with a message suitable for
            # logging and the exit code
            self.shutdown_callback(message, code)

        if self.pidfile is not None:
            self._close_pidfile()

        self._shutdown_complete = True
        sys.exit(code)
172488
protected function registerErrorHandling()
    {
        mysqli_report(MYSQLI_REPORT_STRICT);
        
        set_error_handler(function ($level, $message, $file = '', $line = 0) {
            if (error_reporting() & $level) {
                throw new ErrorException($message, 0, $level, $file, $line);
            }
        });
        
        set_exception_handler(function ($e) {
            $this->handleUncaughtException($e);
        });
        
        register_shutdown_function(function () {
            if (! is_null($error = error_get_last()) && $this->isFatalError($error['type'])) {
                $this->handleUncaughtException(new FatalErrorException(
                    $error['message'], $error['type'], 0, $error['file'], $error['line']
                ));
            }
        });
    }
405424
public function shutdownHandler()
    {
        $lastError = error_get_last();

        if (is_array($lastError)) {
            $this->errorHandler(
                $lastError[ 'type' ],
                $lastError[ 'message' ],
                $lastError[ 'file' ],
                $lastError[ 'line' ]
            );
        }
    }
1164521
public function onShutdown()
    {
        $error = error_get_last();
        if ($error === null) {
            return;
        }
        if (($error['type'] & error_reporting()) === 0) {
            return;
        }
        if ($this->lastError !== null &&
            $error['message'] === $this->lastError['message'] &&
            $error['file'] === $this->lastError['file'] &&
            $error['line'] === $this->lastError['line']) {
            return;
        }
        $trace = [[
            'file' => $error['file'],
            'line' => $error['line'],
        ]];
        $exc = new Errors\Fatal($error['message'], $trace);
        $this->notifier->notify($exc);
    }
138228
public function shutdown() {
        if (($error = error_get_last())) {
            ob_clean();
            /* log error */
            $msg = $error["message"] . " in file: " . $error["file"] . " on line: " . $error["line"];
            $log = new Logger('kernel');
            $file = self::get("dir", "log") . "/log-" . date("Ymd") . ".log";
            $log->pushHandler(new StreamHandler($file, Logger::ERROR));
            switch ($this->mode) {
                case self::$MODE_PRODUCTION:
                    $log->addError($msg);
                    $request = new HttpRequest();
                    $class = self::get("defaultController");
                    $method = self::get("errorMethod");
                    $controller = new $class();
                    $this->dispatch($controller, $method, $request);
                    break;
                case self::$MODE_DEVELOPMENT:
                    die($msg);
                    break;

                default:
                    echo $msg;
                    break;
            }
        }
    }
696038
protected function registerErrorHandle(): void
    {
        \set_error_handler([$this, 'handleError']);
        \set_exception_handler([$this, 'handleException']);
        \register_shutdown_function(function () {
            if ($e = \error_get_last()) {
                $this->handleError($e['type'], $e['message'], $e['file'], $e['line']);
            }
        });
    }
801737
public function errorAtShutdown()
    {
        $error = error_get_last();
        if (isset($error)) {
            $this->onAnyException(new \ErrorException($error['message'], $error['type'], 1, $error['file'], $error['line']));
        }
    }
984733
public function handleShutdown()
    {
        if ( ! is_null($error = error_get_last()) && $this->isFatal($error['type']))
        {
            $log = $this->getLog();
            if ($log instanceof Writer) {
                $log->error($error['message'] . " in " . $error['file'] . " on line " . $error['line']);
            }
        }
    }
762953
public static function checkErrors()
    {
        if (self::STATUS_SHUTDOWN != self::$_status) {
            $error_msg = 'Worker['. getmypid() .'] process terminated with ';
            $errors    = error_get_last();
            if ($errors && ($errors['type'] === E_ERROR ||
                    $errors['type'] === E_PARSE ||
                    $errors['type'] === E_CORE_ERROR ||
                    $errors['type'] === E_COMPILE_ERROR ||
                    $errors['type'] === E_RECOVERABLE_ERROR)
            ) {
                $error_msg .= self::getErrorType($errors['type']) . " \"{$errors['message']} in {$errors['file']} on line {$errors['line']}\"";
            } else {
                $error_msg .= 'exit()/die(). Please do not call exit()/die() in workerman.';
            }
            self::log($error_msg);
        }
    }
344794
public void shutdown() {
		for (ShutdownListener shutdownListener : shutdownListeners) {
			try {
				shutdownListener.shutdown();
			} catch(Exception e) {
				LOGGER.severe("failed shutdown"+e.getMessage());
			}
		}
	}
1085428
public static function shutdownHandler(): void
    {
        if (!self::$reserved) {
            return;
        }

        $error = \error_get_last();
        if (\in_array($error['type'],
            [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE, E_RECOVERABLE_ERROR, E_USER_ERROR], true
        )) {
            self::exceptionHandler(
                Helpers::fixStack(
                    new \ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line'])
                ), false
            );
        }
    }
1240266
public function handleShutdown()
	{
		$error = error_get_last();

		// If an error has occurred that has not been displayed, we will create a fatal
		// error exception instance and pass it into the regular exception handling
		// code so it can be displayed back out to the developer for information.
		if ( ! is_null($error))
		{
			extract($error);

			if ( ! $this->isFatal($type)) return;

			$this->handleException(new FatalError($message, $type, 0, $file, $line))->send();
		}
	}
1075900
async def shutdown(self):
        
        if self._was_shutdown:
            return
        self._was_shutdown = True

        for handler in reversed(self.handlers):
            if not handler:
                continue
            try:
                if handler.initialized:
                    await handler.flush()
                    await handler.close()

            except Exception:
                """
                Ignore errors which might be caused
                because handlers have been closed but
                references to them are still around at
                application exit. Basically ignore everything, 
                as we're shutting down
                """
                pass
929927
public function shutdown()
    {

        // query whether or not, class has been shutdown by an unhandled error
        if ($lastError = error_get_last()) {
            // add the passed error information to the array with the errors
            $error = ErrorUtil::singleton()->fromArray($lastError);
            // log the error messge and return TRUE, to prevent execution of additinoal error handlers
            LoggerUtils::log(LogLevel::ERROR, ErrorUtil::singleton()->prepareMessage($error));
        }
    }
388782
private void captureFailure(AssertionError captured) {
    if (failure != null) {
      // TODO(diamondm) is it worthwhile to add the failures as suppressed exceptions?
      throw new AssertionError(
          lenientFormat(
              "ExpectFailure.whenTesting() caught multiple failures:\n\n%s\n\n%s\n",
              Platform.getStackTraceAsString(failure), Platform.getStackTraceAsString(captured)));
    }
    failure = captured;
  }
603288
public function handleShutdown()
	{
		if (!$this->shutdownHandlerRegistered)
		{
			return;
		}

		$error = error_get_last();
		if ($error && Severity::fromPhpErrorNo($error['type']) >= $this->minSeverityOnShutdown)
		{
			$this->handleError(
				$error['type'],
				$error['message'],
				$error['file'],
				$error['line']
			);
		}
	}