Created by: gcatanese
@antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) @ph4r5h4d (2021/04)
Improve error message when error returns RFC7807 model Fix #13679 (closed)
PR checklist
-
Read the contribution guidelines. -
Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community. -
Run the following to build the project and update samples: ./mvnw clean package ./bin/generate-samples.sh ./bin/utils/export_docs_generators.sh
./bin/generate-samples.sh bin/configs/java*
. For Windows users, please run the script in Git BASH. -
File the PR against the correct branch: master
(6.1.0) (minor release - breaking changes with fallbacks),7.0.x
(breaking changes without fallbacks) -
If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
Activity
added Client: Go Enhancement: General labels
changed milestone to %6.2.1
Created by: gcatanese
@wing328 It should be ok now, I had to remove the Mustache plugin for IntelliJ that was altering my indentation (sorry to waste your time)
Created by: jmontroy90
@gcatanese This PR introduced a panic into our code because it was trying to parse our custom error response according to RFC7807. Our custom error response doesn't have a
Title
orDetail
field, so both of those reflect-based lookups are invalid and the first one hit in the code path (Title
) caused a panic. Can you take a look?Specifically, can the code check to ensure that the given error response conforms to RFC7807 before it tries to extract out its fields?
Created by: gcatanese
Hey @jmontroy90 I had a look and I cannot reproduce the problem. The
formatErrorMessage
checks if the field exists before extracting itmetaValue := reflect.ValueOf(v).Elem() field := metaValue.FieldByName("Title") if field != (reflect.Value{}) { str = fmt.Sprintf("%s", field.Interface()) }
Am I missing something?
mentioned in merge request !14066 (merged)