FatalException and proper plugin detection
Using our own Exception makes it easier to differentiate fatal errors from others in the log
This commit is contained in:
parent
cb4cefebb3
commit
dbe0790d4c
|
@ -2,6 +2,13 @@
|
|||
|
||||
namespace dokuwiki;
|
||||
|
||||
use dokuwiki\Exception\FatalException;
|
||||
|
||||
/**
|
||||
* Manage the global handling of errors and exceptions
|
||||
*
|
||||
* Developer may use this to log and display exceptions themselves
|
||||
*/
|
||||
class ErrorHandler
|
||||
{
|
||||
|
||||
|
@ -88,7 +95,7 @@ EOT;
|
|||
}
|
||||
|
||||
/**
|
||||
* Last resort to handle fatal errors that still can't be cought
|
||||
* Last resort to handle fatal errors that still can't be caught
|
||||
*/
|
||||
public static function fatalShutdown()
|
||||
{
|
||||
|
@ -106,7 +113,7 @@ EOT;
|
|||
)
|
||||
) {
|
||||
self::fatalException(
|
||||
new \ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line'])
|
||||
new FatalException($error['message'], 0, $error['type'], $error['file'], $error['line'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -139,6 +146,10 @@ EOT;
|
|||
*/
|
||||
protected static function guessPlugin($e)
|
||||
{
|
||||
if (preg_match('/lib\/plugins\/(\w+)\//', str_replace('\\', '/', $e->getFile()), $match)) {
|
||||
return $match[1];
|
||||
}
|
||||
|
||||
foreach ($e->getTrace() as $line) {
|
||||
if (
|
||||
isset($line['class']) &&
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace dokuwiki\Exception;
|
||||
|
||||
/**
|
||||
* Fatal Errors are converted into this Exception in out Shutdown handler
|
||||
*/
|
||||
class FatalException extends \ErrorException
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue