1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 17:54:44 +02:00

Add WireShutdown::fatalError() hookable method to enable hooking fatal errors

This commit is contained in:
Ryan Cramer
2021-02-12 10:10:58 -05:00
parent 4406086241
commit 861d7163f6

View File

@@ -8,6 +8,8 @@
* Look for errors at shutdown and log them, plus echo the error if the page is editable
*
* https://processwire.com
*
* @method void fatalError(array $error)
*
*/
@@ -471,6 +473,15 @@ class WireShutdown extends Wire {
return $out === $token ? false : true;
}
/**
* Hook called when fatal error received by shutdown()
*
* @param array $error
* @since 3.0.173
*
*/
protected function ___fatalError($error) { }
/**
* Shutdown function registered with PHP
*
@@ -484,6 +495,7 @@ class WireShutdown extends Wire {
if(!$error) return true;
if(!in_array($error['type'], $this->fatalTypes)) return true;
if(empty($this->error)) $this->fatalError($error);
$this->error = $error;
$this->prepareLabels();
$config = $this->config;