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

letsdrink / ouzo / 7170637656

11 Dec 2023 04:47PM UTC coverage: 85.672% (-0.3%) from 85.99%
7170637656

push

github

web-flow
Refactored exception/error handlers. (#322)

14 of 30 new or added lines in 6 files covered. (46.67%)

2 existing lines in 1 file now uncovered.

4963 of 5793 relevant lines covered (85.67%)

67.63 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
    {
NEW
19
        if ($this->isPrettyHandlerNeeded()) {
×
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 isPrettyHandlerNeeded(): 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