Git Product home page Git Product logo

Comments (8)

tintoy avatar tintoy commented on July 17, 2024

Good idea! Have been meaning to do this - will look into it in an hour or so.

from dotnet-kube-client.

tintoy avatar tintoy commented on July 17, 2024

We have this, BTW, it's just not being used consistently:

https://github.com/tintoy/dotnet-kube-client/blob/develop/src/KubeClient/KubeClientException.cs

from dotnet-kube-client.

tintoy avatar tintoy commented on July 17, 2024

I reckon d13797a is a good start :)

Any feedback?

from dotnet-kube-client.

felixfbecker avatar felixfbecker commented on July 17, 2024

Oh, I didn't realise that this already existed.
I am still getting HttpRequestException with DynamicClient.Patch() though...

from dotnet-kube-client.

tintoy avatar tintoy commented on July 17, 2024

Interesting - you mean the non-generic HttpRequestException (rather than HttpRequestException<TResponse>)?

// Ensure that HttpStatusCode.NotFound actually refers to the target resource.
StatusV1 status = await responseMessage.ReadContentAsAsync<StatusV1, StatusV1>(HttpStatusCode.NotFound).ConfigureAwait(false);
if (status.Reason == "NotFound")
{
string errorMessage = isNamespaced ?
$"Failed to patch {apiVersion}/{kind} resource '{name}' in namespace '{kubeNamespace}' (resource not found)."
:
$"Failed to patch {apiVersion}/{kind} resource '{name}' (resource not found).";
throw new KubeClientException(errorMessage);
}
throw new KubeClientException($"Failed to patch {apiVersion}/{kind} resource (HTTP status {responseMessage.StatusCode}).",
innerException: new HttpRequestException<StatusV1>(responseMessage.StatusCode, status)
);

from dotnet-kube-client.

tintoy avatar tintoy commented on July 17, 2024

Hi sorry for the silence on this end - as usual, work and life get in the way. Will be spending some more time on this tonight to add tests that verify error handling. Let me know if you have opinions or other input :)

from dotnet-kube-client.

tintoy avatar tintoy commented on July 17, 2024

@felixfbecker - what do you reckon, is this test good enough?

d19dae0

PS. As a result of writing this test, I found and fixed the problem where you'd still see HttpRequestException<TResponse> instead of KubeClientException.

I'll try to get a proper release together before the end of this weekend :)

from dotnet-kube-client.

tintoy avatar tintoy commented on July 17, 2024

This has been resolved as of the most recent release. Feel free to reopen if you hit any non-KubeClient exceptions that you think shouldn't be exposed to callers :)

from dotnet-kube-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.