• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

letsdrink / ouzo / 7170613238

11 Dec 2023 04:45PM UTC coverage: 86.0% (+0.01%) from 85.99%
7170613238

Pull #322

github

bbankowski
Refactored exception/error handlers.
Pull Request #322: Refactored exception/error handlers.

14 of 29 new or added lines in 6 files covered. (48.28%)

2 existing lines in 1 file now uncovered.

4982 of 5793 relevant lines covered (86.0%)

101.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Ouzo/Core/ExceptionHandling/DebugExceptionHandler.php
1
<?php
2
/*
3
 * Copyright (c) Ouzo contributors, https://github.com/letsdrink/ouzo
4
 * This file is made available under the MIT License (view the LICENSE file for more information).
5
 */
6

7
namespace Ouzo\ExceptionHandling;
8

9
use Ouzo\Http\MediaType;
10
use Ouzo\Response\ResponseTypeResolve;
11
use Ouzo\Uri;
12
use Whoops\Handler\PrettyPageHandler;
13
use Whoops\Run;
14

15
class DebugExceptionHandler extends ExceptionHandler
16
{
17
    public function runDefaultHandler($exception): void
18
    {
19
        if ($this->needPrettyHandler()) {
×
20
            $run = new Run();
×
21
            $run->pushHandler(new PrettyPageHandler());
×
22
            $run->pushHandler(new DebugErrorLogHandler());
×
23
            $run->handleException($exception);
×
24
        } else {
25
            $this->handleError(OuzoExceptionData::forException(500, $exception));
×
26
        }
27
    }
28

29
    private function needPrettyHandler(): bool
30
    {
NEW
31
        $isHtmlResponse = ResponseTypeResolve::resolve() === MediaType::TEXT_HTML;
×
32
        return $isHtmlResponse && !Uri::isAjax();
×
33
    }
34
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc