diff --git a/container/src/finance/lib/internal/fetch/prices/internal/base.php b/container/src/finance/lib/internal/fetch/prices/internal/base.php index e07b6f6..24dcaff 100644 --- a/container/src/finance/lib/internal/fetch/prices/internal/base.php +++ b/container/src/finance/lib/internal/fetch/prices/internal/base.php @@ -361,16 +361,17 @@ namespace dfi\prices\internal $code = $e->getCode(); $message = $e->getMessage(); - $print = "server sent error '{$message}' with code '{$code}' for '{$asset['id']}'" - . " - retrying in '{$timer}' seconds"; + $print = "server sent error '{$message}' with code '{$code}' for '{$asset['id']}'"; switch ($code) { - // CoinGecko's unrecoverable error (paid plan needed) - case 10012: + case 400: + utils\CLI::throw_fatal($print); + break; + case 10012: // CoinGecko's unrecoverable error (paid plan needed) utils\CLI::throw_fatal($print); break; default: - utils\CLI::print_warning($print); + utils\CLI::print_warning($print . " - retrying in '{$timer}' seconds"); break; } diff --git a/container/src/finance/lib/internal/fetch/prices/internal/prices/crypto.php b/container/src/finance/lib/internal/fetch/prices/internal/prices/crypto.php index 555e190..2f27947 100644 --- a/container/src/finance/lib/internal/fetch/prices/internal/prices/crypto.php +++ b/container/src/finance/lib/internal/fetch/prices/internal/prices/crypto.php @@ -2,7 +2,7 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2026 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -182,6 +182,14 @@ namespace dfi\prices\internal\prices\crypto } $response = $this->request_impl($url, $header); + if (array_key_exists('statusCode', $response)) { + switch ($response['statusCode']) { + case 200: + break; + default: + throw new \Exception($response['message'], $response['statusCode']); + } + } if (array_key_exists('error', $response)) { throw new \Exception($response['error']); }