diff --git a/GaelO2/app/GaelO/Adapters/HttpClientAdapter.php b/GaelO2/app/GaelO/Adapters/HttpClientAdapter.php index b85c11c11..d2cc43bf5 100644 --- a/GaelO2/app/GaelO/Adapters/HttpClientAdapter.php +++ b/GaelO2/app/GaelO/Adapters/HttpClientAdapter.php @@ -5,9 +5,11 @@ use App\GaelO\Interfaces\Adapters\HttpClientInterface; use App\GaelO\Interfaces\Adapters\Psr7ResponseInterface; use GuzzleHttp\Client; +use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Pool; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; +use Illuminate\Support\Facades\Log; class HttpClientAdapter implements HttpClientInterface { @@ -67,8 +69,15 @@ public function requestUploadArrayDicom(string $method, string $uri, array $file 'fulfilled' => function (Response $response, $index) use (&$responseArray) { $responseArray[] = new Psr7ResponseAdapter($response); }, - 'rejected' => function ($reason, $index) { + 'rejected' => function (RequestException $exception, $index) { + $reason = "Error sending dicom to orthanc"; + if ($exception->hasResponse()) { + $reason = $exception->getResponse()->getReasonPhrase(); + } else { + $reason = $exception->getMessage(); + } // this is delivered each failed request + Log::error('DICOM Import Failed in Orthanc Temporary ' + $reason); }, ]); @@ -147,7 +156,7 @@ public function rowRequest(string $method, string $uri, $body, ?array $headers, $options['sink'] = $ressourceDestination; } - if(!$httpErrors){ + if (!$httpErrors) { $options['http_errors'] = false; } diff --git a/GaelO2/app/GaelO/UseCases/ValidateDicomUpload/ValidateDicomUpload.php b/GaelO2/app/GaelO/UseCases/ValidateDicomUpload/ValidateDicomUpload.php index 920a06c9d..87fd5931a 100644 --- a/GaelO2/app/GaelO/UseCases/ValidateDicomUpload/ValidateDicomUpload.php +++ b/GaelO2/app/GaelO/UseCases/ValidateDicomUpload/ValidateDicomUpload.php @@ -109,7 +109,7 @@ public function execute(ValidateDicomUploadRequest $validateDicomUploadRequest, if ($expectedNumberOfInstances !== $importedNumberOfInstances) { $this->orthancService->deleteFromOrthanc("studies", $importedOrthancStudyID); - throw new GaelOValidateDicomException("Imported DICOM not matching announced number of Instances"); + throw new GaelOValidateDicomException("Imported DICOM (".$importedNumberOfInstances.") not matching announced number of Instances (".$expectedNumberOfInstances.")"); } //Anonymize and store new anonymized study Orthanc ID diff --git a/TODO b/TODO index 6cd13f03a..d280d99da 100644 --- a/TODO +++ b/TODO @@ -15,4 +15,4 @@ Test par etude specifique **Code centres ** Indicatif telephonique international, 0 separateur et code postal geographique (incréent de 1 si plusieurs etablissements) -ex : 33031000 +ex : 33031000 \ No newline at end of file