Code Monkey home page Code Monkey logo

Comments (4)

avinassh avatar avinassh commented on August 14, 2024 1

Hey!

So, gRPC docs finally added few more details on rich error handling - https://grpc.io/docs/guides/error/#richer-error-model

According to the docs:

This richer error model is already supported in the C++, Go, Java, Python, and Ruby libraries, and at least the grpc-web and Node.js libraries have open issues requesting it.

I have started working on and opened a PR - #15

I have added Go and Python examples for now and other language examples later. If anyone interested doing same for C++, Java or Ruby, please let me know. Thank you!

from grpc-errors.

avinassh avatar avinassh commented on August 14, 2024

Does only Go supports this? I can't seem to find much details for other languages.

from grpc-errors.

eyalpost avatar eyalpost commented on August 14, 2024

+1 for client\server examples of handling details
In Java it is also supported this via:

        Status s = com.google.rpc.Status.newBuilder()
                .setCode(com.google.rpc.Code.INVALID_ARGUMENT.getNumber())
                .setMessage("Invalid age")
                .addDetails(Any.pack(BadRequest.newBuilder()
                                .addFieldViolations(BadRequest.FieldViolation
                                        .newBuilder()
                                        .setField("age")
                                        .setDescription("age must be positive ")
                                        .build()
                                ).build()
                        )
                ).build();

        throw io.grpc.protobuf.StatusProto.toStatusRuntimeException(s);

from grpc-errors.

Ciantic avatar Ciantic commented on August 14, 2024

Yes, I would like this for C#, it's really hard to figure out. I guess google.rpc.Status should be inserted in trailers, and embedding e.g. google.rpc.BadRequest inside that.

But no examples anywhere.

I think google.rpc.BadRequest with field violations is so fundamental error type that example of it's usage should be shown.

from grpc-errors.

Related Issues (14)

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.