Skip to content

Commit 4031571

Browse files
committed
consulta tipo de cambio
1 parent c0d7504 commit 4031571

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/Application/Api/TipoCambioController.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,25 +152,14 @@ private function remoteQuery(string $date, string $apiToken): array
152152

153153
return $data;
154154
} catch (RequestException $e) {
155-
// Verificar si es un error 400 específicamente
156-
if ($e->hasResponse() && $e->getResponse()->getStatusCode() === 400) {
155+
if ($e->hasResponse()) {
157156
$body = (string) $e->getResponse()->getBody();
158157
$errorData = json_decode($body, true);
159158

160159
return [
161160
'error' => 'Fecha no válida o sin datos',
162161
'message' => $errorData['error'] ?? 'Invalid request',
163-
'status_code' => 400
164-
];
165-
}
166-
if ($e->hasResponse() && $e->getResponse()->getStatusCode() === 404) {
167-
$body = (string) $e->getResponse()->getBody();
168-
$errorData = json_decode($body, true);
169-
170-
return [
171-
'error' => 'Fecha no válida o sin datos',
172-
'message' => $errorData['error'] ?? 'Invalid request',
173-
'status_code' => 404
162+
'status_code' => $e->getResponse()->getStatusCode()
174163
];
175164
}
176165

0 commit comments

Comments
 (0)