Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Add error information to responses #11

Closed
IljaN opened this issue Mar 12, 2020 · 4 comments · Fixed by #53
Closed

Add error information to responses #11

IljaN opened this issue Mar 12, 2020 · 4 comments · Fixed by #53
Assignees
Labels
enhancement New feature or request

Comments

@IljaN
Copy link
Member

IljaN commented Mar 12, 2020

Currently an rpc-get call results in a 500 internal server error if a key does not exist. It is impossible from a caller perspective to distinguish between not found and real failures.

Proposal:

  • Refactor the protobuf definition like described here i.e wrap results in to XXXResponse envelopes which contain an additional error struct.

  • Instead directly exposing the generated client write a wrapper which transparently unpacks the above envelope and does transparent error-handling? Tough not sure if this would be compatible with micro? Maybe this can be achieved differently?

@refs
Copy link
Member

refs commented Mar 12, 2020

I rather go with the "return nothing" approach here. WDYT?

@refs refs added the enhancement New feature or request label Mar 12, 2020
@IljaN
Copy link
Member Author

IljaN commented Mar 12, 2020

I rather go with the "return nothing" approach here. WDYT?
Yes this would work.

Yes would be possible. But wouldn't this break the if err !=nil pattern at the consumer thus requiring to check for empty Record?

@refs
Copy link
Member

refs commented Mar 12, 2020

We had a deeper look @butonic and I this morning and found a few things we need to tackle. The first and most crucial one is this.

Then there's the issue of whether we should enforce using go-micro clients to handle requests between services vs using the grpc go client, which, this needs TBC, go-micro allows to via setting an environment variable.

If we have to set it on stone I would settle for go-micro client.

@butonic
Copy link
Member

butonic commented Jun 19, 2020

This came up again. And we should use the go-micro errors package, which allows adding error detauls to the error in a similar way that google developed it, which is the official recommendation aka gRPC Richer Error Model

cc @C0rby

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants