Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 1464
Zeile 42... Zeile 42...
42
        $this->debug = \is_bool($debug) ? $debug : $debug(...);
42
        $this->debug = \is_bool($debug) ? $debug : $debug(...);
43
    }
43
    }
Zeile 44... Zeile 44...
44
 
44
 
45
    public function render(\Throwable $exception): FlattenException
45
    public function render(\Throwable $exception): FlattenException
46
    {
46
    {
47
        $headers = [];
47
        $headers = ['Vary' => 'Accept'];
48
        $debug = \is_bool($this->debug) ? $this->debug : ($this->debug)($exception);
48
        $debug = \is_bool($this->debug) ? $this->debug : ($this->debug)($exception);
49
        if ($debug) {
49
        if ($debug) {
50
            $headers['X-Debug-Exception'] = rawurlencode($exception->getMessage());
50
            $headers['X-Debug-Exception'] = rawurlencode($exception->getMessage());
51
            $headers['X-Debug-Exception-File'] = rawurlencode($exception->getFile()).':'.$exception->getLine();
51
            $headers['X-Debug-Exception-File'] = rawurlencode($exception->getFile()).':'.$exception->getLine();
Zeile 52... Zeile 52...
52
        }
52
        }
Zeile 53... Zeile 53...
53
 
53
 
54
        $flattenException = FlattenException::createFromThrowable($exception, null, $headers);
54
        $flattenException = FlattenException::createFromThrowable($exception, null, $headers);
55
 
-
 
56
        try {
55
 
57
            $format = \is_string($this->format) ? $this->format : ($this->format)($flattenException);
-
 
58
            $headers = [
-
 
Zeile 59... Zeile 56...
59
                'Content-Type' => Request::getMimeTypes($format)[0] ?? $format,
56
        try {
60
                'Vary' => 'Accept',
57
            $format = \is_string($this->format) ? $this->format : ($this->format)($flattenException);
61
            ];
58
            $headers['Content-Type'] = Request::getMimeTypes($format)[0] ?? $format;
62
 
59
 
63
            return $flattenException->setAsString($this->serializer->serialize($flattenException, $format, [
-
 
64
                'exception' => $exception,
60
            $flattenException->setAsString($this->serializer->serialize($flattenException, $format, [
65
                'debug' => $debug,
61
                'exception' => $exception,
66
            ]))
62
                'debug' => $debug,
-
 
63
            ]));
-
 
64
        } catch (NotEncodableValueException) {
67
            ->setHeaders($flattenException->getHeaders() + $headers);
65
            $flattenException = $this->fallbackErrorRenderer->render($exception);
Zeile 68... Zeile 66...
68
        } catch (NotEncodableValueException) {
66
        }
69
            return $this->fallbackErrorRenderer->render($exception);
67
 
70
        }
68
        return $flattenException->setHeaders($flattenException->getHeaders() + $headers);