Change Format of API Error (#784)

This is a wire breaking change for json errors since we have removed and renamed a few fields, and changed part of the structure of the returned json error.

* Remove redundant fields in Status, details.error_id, details.TraceId and details.request_id from API errors.

* Added wrapped errors and "ops" field to indicate the internal operation of the errors returned by the API.

* Added error cli error reporting of Op and wrapped errors.
This commit is contained in:
Todd Knight authored and GitHub committed 2020-12-07 14:25:16 -07:00
1 parent 18ea39b237
commit aa4157639c
48 files changed
+742 -728

No files matched your search

@@ -156,7 +156,7 @@ func (c *Command) Run(args []string) int {
result, err = authmethodClient.Read(c.Context, c.FlagId, opts...)
case "delete":
_, err = authmethodClient.Delete(c.Context, c.FlagId, opts...)
if apiErr := api.AsServerError(err); apiErr != nil && apiErr.Status == int32(http.StatusNotFound) {
if apiErr := api.AsServerError(err); apiErr != nil && apiErr.ResponseStatus() == http.StatusNotFound {
existed = false
err = nil
}