HCPE-842: bubble up consul service errors #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🛠️ Description
This PR regenerates the consul service SDK from swagger that was regenerated using grpc-gateway v1.15. This version of grpc-gateway contains this fix, which adds a default error response to each endpoint.
Due to another change that added a
ConsulService_
prefix to each endpoint to ensure uniqueness (an OpenAPI requirement), all of the file names were changed.🏞 Background
Currently, all the service swagger files lack a default error object. This means
go-swagger
can't generate an error handling function for the SDK's consul client, and so the consul client can only return the status code and this unhelpful message:With this change,
go-swagger
will generate error handlers from the default error response in the swagger. Specifically, we get this block:These handlers pass along the complete API error:
🔗 External Links
Follow-up to: https://github.com/hashicorp/cloud-consul-service/pull/964 and https://github.com/hashicorp/cloud-api/pull/32
HCPE-791
🏗️ How to Build and Test the Change
/cmd/hcp-sdk-go-client/main.go
with some call that will error (like a GET for a consul cluster that doesn't exist).go run ./cmd/hcp-sdk-go-client
. Check out that complete API error! ✨👍 Definition of Done