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:
Franz Liedke 2019-08-20 19:46:45 +02:00
parent 3eb1a6f133
commit 18b887ee39
2 changed files with 12 additions and 3 deletions

View File

@ -12,6 +12,7 @@
namespace Flarum\Foundation\ErrorHandling;
use Psr\Log\LoggerInterface;
use Throwable;
/**
* Log caught exceptions to a PSR-3 logger instance.
@ -28,8 +29,8 @@ class LogReporter implements Reporter
$this->logger = $logger;
}
public function report(HandledError $error)
public function report(Throwable $error)
{
$this->logger->error($error->getError());
$this->logger->error($error);
}
}

View File

@ -11,7 +11,15 @@
namespace Flarum\Foundation\ErrorHandling;
use Throwable;
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);
}