Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(http): improve error handling and response to api consumer for org service #16716

Merged
merged 2 commits into from
Feb 4, 2020

Conversation

jsteenb2
Copy link
Contributor

@jsteenb2 jsteenb2 commented Feb 4, 2020

Closes #16498

add a reusable api type for decoding and responding to http requests. Improves error handling.

Work is broken up into 2 commits, first one for creating the API decoder/responder, and the 2nd for using it within the org service. The new API type normalizes handling of decoding issues and failed write issues amongst. It is also very extensible, more we can do with it than what meets the eye.

@jsteenb2 jsteenb2 force-pushed the 16498/better_http_err_messages branch from f8634a6 to 9812d6b Compare February 4, 2020 01:26
@jsteenb2 jsteenb2 changed the title 16498/better http err messages fix(http): improve error handling and response to api consumer for org service Feb 4, 2020
@jsteenb2 jsteenb2 force-pushed the 16498/better_http_err_messages branch 3 times, most recently from a6814d1 to c82f693 Compare February 4, 2020 01:29
@jsteenb2 jsteenb2 force-pushed the 16498/better_http_err_messages branch from c82f693 to 26b9167 Compare February 4, 2020 02:45
@jsteenb2 jsteenb2 requested a review from a team February 4, 2020 03:00

func decodePostOrgRequest(ctx context.Context, r *http.Request) (*postOrgRequest, error) {
Copy link
Contributor Author

@jsteenb2 jsteenb2 Feb 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR axes a bunch of unneccesary indirection, reduce the jumping around and make it easier to follow within the handler itself.

@jsteenb2 jsteenb2 force-pushed the 16498/better_http_err_messages branch from 26b9167 to 6924ab8 Compare February 4, 2020 16:38
@jsteenb2 jsteenb2 merged commit 236f52b into master Feb 4, 2020
@jsteenb2 jsteenb2 deleted the 16498/better_http_err_messages branch February 4, 2020 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Malformed JSON produces unhelpful error message
2 participants