mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 22:04:23 +00:00
fix catching response 400 in relatorio driver
This commit is contained in:
parent
b891ba842d
commit
81689e3507
@ -14,8 +14,10 @@ namespace Chill\DocGeneratorBundle\GeneratorDriver;
|
|||||||
use Chill\DocGeneratorBundle\GeneratorDriver\Exception\TemplateException;
|
use Chill\DocGeneratorBundle\GeneratorDriver\Exception\TemplateException;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
|
use Symfony\Component\HttpClient\Exception\ClientException;
|
||||||
use Symfony\Component\Mime\Part\DataPart;
|
use Symfony\Component\Mime\Part\DataPart;
|
||||||
use Symfony\Component\Mime\Part\Multipart\FormDataPart;
|
use Symfony\Component\Mime\Part\Multipart\FormDataPart;
|
||||||
|
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
|
||||||
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
|
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
|
||||||
use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
|
use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
|
||||||
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
|
||||||
@ -53,8 +55,8 @@ class RelatorioDriver implements DriverInterface
|
|||||||
'body' => $form->bodyToIterable(),
|
'body' => $form->bodyToIterable(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $response->toStream();
|
return $response->getContent();
|
||||||
} catch (HttpExceptionInterface $e) {
|
} catch (ClientExceptionInterface $e) {
|
||||||
$content = $e->getResponse()->getContent(false);
|
$content = $e->getResponse()->getContent(false);
|
||||||
|
|
||||||
if (400 === $e->getResponse()->getStatusCode()) {
|
if (400 === $e->getResponse()->getStatusCode()) {
|
||||||
@ -87,6 +89,18 @@ class RelatorioDriver implements DriverInterface
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
|
} catch (Throwable $exception) {
|
||||||
|
$this
|
||||||
|
->logger
|
||||||
|
->error(
|
||||||
|
'relatorio: Unable to get content from response.',
|
||||||
|
[
|
||||||
|
'msg' => $exception->getMessage(),
|
||||||
|
'e' => $exception->getTraceAsString(),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
throw $exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user