Skip to content

Commit

Permalink
Update error-handling.md
Browse files Browse the repository at this point in the history
  • Loading branch information
stramunin committed Jul 13, 2023
1 parent 7c639e0 commit 6d32fc6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/v4/middleware/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ You can now map custom handlers for any type of Exception or Throwable.
use Psr\Http\Message\ServerRequestInterface;
use Psr\Log\LoggerInterface;
use Slim\Factory\AppFactory;
use Slim\Psr7\Response;

require __DIR__ . '/../vendor/autoload.php';

Expand All @@ -62,7 +61,9 @@ $customErrorHandler = function (
bool $logErrorDetails,
?LoggerInterface $logger = null
) use ($app) {
$logger->error($exception->getMessage());
if ($logger) {
$logger->error($exception->getMessage());
}

$payload = ['error' => $exception->getMessage()];

Expand Down

0 comments on commit 6d32fc6

Please sign in to comment.