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

Log construction failures for user-defined parameters in operation handlers to improve error diagnosis. #3746

Closed
drganjoo opened this issue Jul 9, 2024 · 1 comment · Fixed by #3378

Comments

@drganjoo
Copy link
Contributor

drganjoo commented Jul 9, 2024

An operation handler can accept user-defined data types as long as they implement FromParts. This trait has an associated type called Rejection, which is used to signal an error if the user-defined data type cannot be constructed from the request.

Similarly, FromRequest is used by the framework to construct input/output structures (and their members) from the request. If it fails to do so, it raises an error using its Rejection associated type.

For example, if FromRequest fails to construct a parameter because Extension<State> is expected by the user-defined operation handler, but Extension<Arc<State>> is actually added by the extension layer, the server does not currently log a message indicating this construction failure. Instead, it simply returns a 500 Internal Server Error.

To improve troubleshooting, the server should log an entry to help users identify when a parameter could not be constructed.

@drganjoo drganjoo closed this as completed Jul 9, 2024
@drganjoo
Copy link
Contributor Author

drganjoo commented Jul 9, 2024

#3378

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 a pull request may close this issue.

1 participant