mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Catch various errors.
This commit is contained in:
@@ -74,17 +74,19 @@ class FixerIOv2 implements ExchangeRateInterface
|
||||
);
|
||||
$statusCode = -1;
|
||||
Log::debug(sprintf('Going to request exchange rate using URI %s', str_replace($apiKey, 'xxxx', $uri)));
|
||||
$client = new Client;
|
||||
try {
|
||||
$client = new Client;
|
||||
|
||||
$res = $client->request('GET', $uri);
|
||||
$statusCode = $res->getStatusCode();
|
||||
$body = $res->getBody()->getContents();
|
||||
Log::debug(sprintf('Result status code is %d', $statusCode));
|
||||
Log::debug(sprintf('Result body is: %s', $body));
|
||||
} catch (GuzzleException|Exception $e) {
|
||||
// don't care about error
|
||||
$body = sprintf('Guzzle exception: %s', $e->getMessage());
|
||||
$body = sprintf('Guzzle exception: %s', $e->getMessage());
|
||||
$statusCode = 500;
|
||||
}
|
||||
Log::debug(sprintf('Result status code is %d', $statusCode));
|
||||
Log::debug(sprintf('Result body is: %s', $body));
|
||||
|
||||
$content = null;
|
||||
if (200 !== $statusCode) {
|
||||
@@ -103,7 +105,7 @@ class FixerIOv2 implements ExchangeRateInterface
|
||||
}
|
||||
|
||||
$exchangeRate->rate = $rate;
|
||||
if ($rate !== 0.0) {
|
||||
if (0.0 !== $rate) {
|
||||
Log::debug('Rate is not zero, save it!');
|
||||
$exchangeRate->save();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user