Skip to content

Commit

Permalink
Avoid suppressed JSON error here.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuppett committed Dec 2, 2023
1 parent 363e3bf commit d3c01a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Traits/Cluster/ChecksClusterVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Composer\Semver\VersionParser;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\GuzzleException;
use JsonException;
use RenokiCo\PhpK8s\Exceptions\KubernetesAPIException;

trait ChecksClusterVersion
Expand All @@ -21,6 +22,7 @@ trait ChecksClusterVersion
* @return void
*
* @throws KubernetesAPIException|GuzzleException
* @throws JsonException
*/
protected function loadClusterVersion(): void
{
Expand All @@ -42,7 +44,7 @@ protected function loadClusterVersion(): void
);
}

$json = @json_decode($response->getBody(), true);
$json = json_decode($response->getBody(), true, 512, JSON_THROW_ON_ERROR);

$parser = new VersionParser();
$this->kubernetesVersion = $parser->normalize($json['gitVersion']);
Expand Down

0 comments on commit d3c01a9

Please sign in to comment.