upgraded dependencies
This commit is contained in:
@@ -37,11 +37,11 @@ class SerializerErrorRenderer implements ErrorRendererInterface
|
||||
public function __construct(SerializerInterface $serializer, $format, ErrorRendererInterface $fallbackErrorRenderer = null, $debug = false)
|
||||
{
|
||||
if (!\is_string($format) && !\is_callable($format)) {
|
||||
throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be a string or a callable, "%s" given.', __METHOD__, \is_object($format) ? \get_class($format) : \gettype($format)));
|
||||
throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be a string or a callable, "%s" given.', __METHOD__, \gettype($format)));
|
||||
}
|
||||
|
||||
if (!\is_bool($debug) && !\is_callable($debug)) {
|
||||
throw new \TypeError(sprintf('Argument 4 passed to "%s()" must be a boolean or a callable, "%s" given.', __METHOD__, \is_object($debug) ? \get_class($debug) : \gettype($debug)));
|
||||
throw new \TypeError(sprintf('Argument 4 passed to "%s()" must be a boolean or a callable, "%s" given.', __METHOD__, \gettype($debug)));
|
||||
}
|
||||
|
||||
$this->serializer = $serializer;
|
||||
@@ -55,7 +55,14 @@ class SerializerErrorRenderer implements ErrorRendererInterface
|
||||
*/
|
||||
public function render(\Throwable $exception): FlattenException
|
||||
{
|
||||
$flattenException = FlattenException::createFromThrowable($exception);
|
||||
$headers = [];
|
||||
$debug = \is_bool($this->debug) ? $this->debug : ($this->debug)($exception);
|
||||
if ($debug) {
|
||||
$headers['X-Debug-Exception'] = rawurlencode($exception->getMessage());
|
||||
$headers['X-Debug-Exception-File'] = rawurlencode($exception->getFile()).':'.$exception->getLine();
|
||||
}
|
||||
|
||||
$flattenException = FlattenException::createFromThrowable($exception, null, $headers);
|
||||
|
||||
try {
|
||||
$format = \is_string($this->format) ? $this->format : ($this->format)($flattenException);
|
||||
@@ -66,7 +73,7 @@ class SerializerErrorRenderer implements ErrorRendererInterface
|
||||
|
||||
return $flattenException->setAsString($this->serializer->serialize($flattenException, $format, [
|
||||
'exception' => $exception,
|
||||
'debug' => \is_bool($this->debug) ? $this->debug : ($this->debug)($exception),
|
||||
'debug' => $debug,
|
||||
]))
|
||||
->setHeaders($flattenException->getHeaders() + $headers);
|
||||
} catch (NotEncodableValueException $e) {
|
||||
|
Reference in New Issue
Block a user