GithubHelp home page GithubHelp logo

Comments (7)

lyonlai avatar lyonlai commented on May 19, 2024 1

gRPC error returned from grpc-gateway is still http 200 but with error object as JSON returned iirc.

from protoc-gen-grpc-gateway-ts.

remko avatar remko commented on May 19, 2024 1

@lyonlai I don't, but I should be able to easily do, just wanted to check up front. I will do the changes and verify it with my use case, and send a PR.

from protoc-gen-grpc-gateway-ts.

atreya2011 avatar atreya2011 commented on May 19, 2024

@remko You could just check the error object instead.

from protoc-gen-grpc-gateway-ts.

remko avatar remko commented on May 19, 2024

@lyonlai No,grpc-gateway maps gRPC codes to HTTP

< HTTP/1.1 401 Unauthorized
< Content-Type: application/json; charset=utf-8
< Date: Tue, 18 May 2021 05:46:57 GMT
< Content-Length: 40
< 
{"status":401,"message":"Unauthorized"}

from protoc-gen-grpc-gateway-ts.

remko avatar remko commented on May 19, 2024

@atreya2011 There's no unambiguous way to check for an error object at that level. I would have to check for the presence of status and message properties, which could exist on a regular object too (e.g. a chat service presence message would have those fields)

Moreover, I would need to manually do this check for every call, or at least manually wrap every call, which is tedious.

from protoc-gen-grpc-gateway-ts.

lyonlai avatar lyonlai commented on May 19, 2024

hmm. I see, that make sense. @remko do you have something already and you wanted to contribute?

from protoc-gen-grpc-gateway-ts.

lyonlai avatar lyonlai commented on May 19, 2024

awesome, expecting it.

from protoc-gen-grpc-gateway-ts.

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.