Merge branch 'master' into feat/add-document-encrypter-service

This commit is contained in:
2022-04-26 14:52:13 +02:00
8 changed files with 36 additions and 10 deletions

View File

@@ -14,8 +14,10 @@ namespace Chill\DocGeneratorBundle\GeneratorDriver;
use Chill\DocGeneratorBundle\GeneratorDriver\Exception\TemplateException;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpClient\Exception\ClientException;
use Symfony\Component\Mime\Part\DataPart;
use Symfony\Component\Mime\Part\Multipart\FormDataPart;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
@@ -54,7 +56,9 @@ final class RelatorioDriver implements DriverInterface
'headers' => $form->getPreparedHeaders()->toArray(),
'body' => $form->bodyToIterable(),
]);
} catch (HttpExceptionInterface $e) {
return $response->getContent();
} catch (ClientExceptionInterface $e) {
$content = $e->getResponse()->getContent(false);
if (400 === $e->getResponse()->getStatusCode()) {
@@ -87,6 +91,18 @@ final class RelatorioDriver implements DriverInterface
]);
throw $e;
} catch (Throwable $exception) {
$this
->logger
->error(
'relatorio: Unable to get content from response.',
[
'msg' => $exception->getMessage(),
'e' => $exception->getTraceAsString(),
]
);
throw $exception;
}
try {