php: fetch: prices: crypto: throw errors with nested status
This commit is contained in:
@@ -58,6 +58,10 @@ namespace docker_finance\prices\internal\prices\crypto
|
||||
$url = "https://{$domain}/api/v3/coins/{$asset['id']}/market_chart?vs_currency={$vs_currency}&days={$timestamp}";
|
||||
|
||||
$response = $this->request_impl($url, $header);
|
||||
if (array_key_exists('error', $response)) {
|
||||
$status = $response['error']['status'];
|
||||
throw new \Exception($status['error_message'], $status['error_code']);
|
||||
}
|
||||
if (array_key_exists('status', $response)) {
|
||||
$status = $response['status'];
|
||||
throw new \Exception($status['error_message'], $status['error_code']);
|
||||
|
||||
Reference in New Issue
Block a user