Skip to content

Commit 724b31c

Browse files
FIX: Manejo de ConnectException en consumo de servicio SII
1 parent 35e36bf commit 724b31c

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/ApiClient.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,15 @@ public function consume(
391391
options: $options
392392
);
393393
} catch (\GuzzleHttp\Exception\RequestException $e) {
394-
// Obtener la respuesta de la llamada.
395394
if ($e->hasResponse()) {
396395
$this->last_response = $e->getResponse();
397396
}
398-
// Se lanza la excepción.
399397
$this->throwException();
398+
} catch (\GuzzleHttp\Exception\ConnectException $e) {
399+
throw new ApiException(
400+
message: 'Error de conexión con el SII: ' . $e->getMessage(),
401+
code: 500
402+
);
400403
}
401404

402405
// Entregar respuesta (contenida en el mismo objeto del cliente).

tests/sii/rcv/ObtenerCompraDetalleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function testObtenerCompraDetalle(): void
9797
);
9898

9999
if ($compras_resumen_array['data'] != null) {
100-
foreach ($compras_resumen_array as $resumen) {
100+
foreach ($compras_resumen_array['data'] as $resumen) {
101101
if (
102102
$resumen['dcvTipoIngresoDoc'] != 'DET_ELE' ||
103103
$resumen['rsmnTotDoc'] == 0

0 commit comments

Comments
 (0)