moved the $payload property to the WithPayload trait
created dedicated exceptions for every of 400, 401, 403, 404, 405, 429 HTTP response codes
catch the ConnectException from Guzzle that escaped the encapsulation, now replaced with a ClusterNotReachableException
Points 1., 2. and 3.
Those points are for maximum backward compatibility.
Point 4
This point is for helping users of the library to identify the type of error that happened without having to parse Guzzle's exception messages. The codeprovided to the exceptions are very often at 0 and does not provide any help to discriminate error types.
Also, the original exception was lost and not provided to the newly created exception. This complexifies the debugging by hiding the real source of the error.
Point 5
An exception from Guzzle is escaping the encapsulation. This happens when the API server is not reachable through the network this includes cases like :
you or the cluster are not connected to the internet or the same private network
the cluster is stopped
you have an invalid TLS certificate for the domain you are using
Possible breaking changes
If you were previously instanciating PhpK8sException or KubernetesAPIException classes, it will not be possible anymore as they have been transformed into interfaces.
Positive impacts
All your try ... catch statements will continue to work seamlessly as the new exception classes implement the PhpK8sException and KubernetesAPIException interfaces. You may however want to change your statements to use the new exception classes and ease your error management.
Refactored HTTP exception management, with possible breaking changes:
$payload
property to the WithPayload traitPoints 1., 2. and 3.
Those points are for maximum backward compatibility.
Point 4
This point is for helping users of the library to identify the type of error that happened without having to parse Guzzle's exception messages. The
code
provided to the exceptions are very often at0
and does not provide any help to discriminate error types.Also, the original exception was lost and not provided to the newly created exception. This complexifies the debugging by hiding the real source of the error.
Point 5
An exception from Guzzle is escaping the encapsulation. This happens when the API server is not reachable through the network this includes cases like :
Possible breaking changes
If you were previously instanciating PhpK8sException or KubernetesAPIException classes, it will not be possible anymore as they have been transformed into interfaces.
Positive impacts
All your
try ... catch
statements will continue to work seamlessly as the new exception classes implement the PhpK8sException and KubernetesAPIException interfaces. You may however want to change your statements to use the new exception classes and ease your error management.