• 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/ErrorRenderer.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\Response\ResponseTypeResolve;
10
use Ouzo\ViewPathResolver;
11

12
class ErrorRenderer implements Renderer
13
{
14
    public function render(OuzoExceptionData $exceptionData, ?string $viewName): void
15
    {
UNCOV
16
        $errorMessage = $exceptionData->getMessage();
×
17
        $errorTrace = $exceptionData->getStackTrace()->getTraceAsString();
×
18

19
        $this->clearOutputBuffers();
×
20
        header($exceptionData->getHeader());
×
21
        $responseType = ResponseTypeResolve::resolve();
×
NEW
22
        header("Content-type: {$responseType}");
×
23

24
        $additionalHeaders = $exceptionData->getAdditionalHeaders();
×
25
        array_walk($additionalHeaders, function ($header) {
×
26
            header($header);
×
27
        });
×
28

UNCOV
29
        require(ViewPathResolver::resolveViewPath($viewName, $responseType));
×
30
    }
31

32
    private function clearOutputBuffers(): void
33
    {
34
        while (ob_get_level()) {
×
35
            if (!ob_end_clean()) {
×
36
                break;
×
37
            }
38
        }
39
    }
40
}
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

© 2026 Coveralls, Inc