csharp icon indicating copy to clipboard operation
csharp copied to clipboard

Handle config was not read due some issue and display what was the error instead of generic deserialization error

Open LeszekKalibrate opened this issue 4 months ago • 4 comments

In file, line https://github.com/kubernetes-client/csharp/blob/master/src/KubernetesClient/KubernetesClientConfiguration.ConfigFile.cs#L572 There is no check that the output was successful, so when it fails we get just a dump deserialization error.

Can a simple check like string.IsNulOrEmpty be added and then if yes , throw an exception, but with the text from error output?

Sometimes I get randomly that error, and today it was due to personal access token expired, but deserialization error for an empty string does not give any hint. Thank you.

Using: var kubernetesClientConfig = KubernetesClientConfiguration.BuildDefaultConfig(); to read from kube/.config file.

LeszekKalibrate avatar Aug 04 '25 11:08 LeszekKalibrate