Skip to content

log: display client error messages when possible as warnings#691

Merged
Fishrock123 merged 2 commits intohttp-rs:mainfrom
Fishrock123:logger-client-error-messages
Sep 3, 2020
Merged

log: display client error messages when possible as warnings#691
Fishrock123 merged 2 commits intohttp-rs:mainfrom
Fishrock123:logger-client-error-messages

Conversation

@Fishrock123
Copy link
Member

This should help demystify some cases when client errors are determined by parsing and propagated via ?.

Description

Makes the logger display an associated error message when this warning occurs, if possible.

Also clarified that a client error occured.

Motivation and Context

For never users some cases of client errors being caused by e.g. body parsing and then propgated via ? may be unobvious. This helps demystify that.

How Has This Been Tested?

Manual curl to the json example. Output:

tide::log::middleware Client error --> Response sent
    message missing field `name` at line 1 column 2
    method POST
    path /submit
    status 422
    duration 73.9µs

Checklist:

  • I have read the CONTRIBUTING document.
  • All new and existing tests passed.

This should help demystify some cases when client errors are determined by parsing and propagated via `?`.
This should help the default logger be as helpful as possible.
@Fishrock123 Fishrock123 force-pushed the logger-client-error-messages branch from fa1f3b7 to b373610 Compare September 1, 2020 01:06
Copy link
Member

@jbr jbr left a comment

Choose a reason for hiding this comment

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

👍

@Fishrock123 Fishrock123 merged commit b373610 into http-rs:main Sep 3, 2020
@Fishrock123 Fishrock123 deleted the logger-client-error-messages branch September 3, 2020 16:54
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.

2 participants