mirror of
https://github.com/flarum/framework.git
synced 2024-11-30 13:36:10 +08:00
Error handling: Tweak Reporter interface
Because reporters are used for exceptions we were not able to handle, it makes sense to simply pass the exception, not the "handled error".
This commit is contained in:
parent
3eb1a6f133
commit
18b887ee39
|
@ -12,6 +12,7 @@
|
||||||
namespace Flarum\Foundation\ErrorHandling;
|
namespace Flarum\Foundation\ErrorHandling;
|
||||||
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log caught exceptions to a PSR-3 logger instance.
|
* Log caught exceptions to a PSR-3 logger instance.
|
||||||
|
@ -28,8 +29,8 @@ class LogReporter implements Reporter
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function report(HandledError $error)
|
public function report(Throwable $error)
|
||||||
{
|
{
|
||||||
$this->logger->error($error->getError());
|
$this->logger->error($error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,15 @@
|
||||||
|
|
||||||
namespace Flarum\Foundation\ErrorHandling;
|
namespace Flarum\Foundation\ErrorHandling;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
interface Reporter
|
interface Reporter
|
||||||
{
|
{
|
||||||
public function report(HandledError $error);
|
/**
|
||||||
|
* Report an error that Flarum was not able to handle to a backend.
|
||||||
|
*
|
||||||
|
* @param Throwable $error
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function report(Throwable $error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user