googleapis / googleapis/gapic-showcase

make internal Showcase errors be reported as proper gRPC errors with status and detais

Open
#1,575 0 comments 0 reactions 0 assignees View on GitHub
priority: p2 type: bug
Dominant language
Go
Stars
183
Forks
55
Avg merge
1d 1h
Merged PRs (30d)
8

Description

As a result of #1573 , we'll be able to report errors in a more standard format. It would be elegant to update the reporting of internal Showcase errors to be in this more standard format.

To do this just on the REST side, it seems we would need to update `goviewcreator.go` to read something like this:

```go
file.P("func (backend *RESTBackend) ReportGRPCError(w http.ResponseWriter, err error) {")
file.P(" st, ok := status.FromError(err)")
file.P(" if !ok {")
file.P(` backend.Error(w, http.StatusInternalServerError, "** server error in ReportGRPCError: %%s\n---Error: %%+v\nStatus: %%+v\n", err.Error(), err, st)`)
file.P(` resttools.ErrorResponse(w, resttools.NoCodeHTTP, codes.Internal, "non-gRPC error", errdetails.ErrorInfo{Reason: err.Error(), Domain: "showcase server"})`)
file.P(" return")
file.P(" }")
```

(The line right before the return statement is the new one.)

However, we should also report these more stamdard errors over gRPC transport.

Moreover this has implications for existing Showcase unit tests and possibly for generator repositories which may depend on Showcase, so we should proceed with care.

Contributor guide

Open the contributing guide

Research direction

Start with goviewcreator.go and the proposed REST error-reporting change, then review how internal Showcase errors are transported over gRPC. Run the existing Showcase unit tests and check generator repositories that depend on Showcase; done means standard status-bearing errors are reported over both REST and gRPC without breaking those tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, grpc
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.