FromParts<Protocol>::Rejection
must implement std::fmt::Display
for user-defined parameters passed to operation handlers
#3749
drganjoo
announced in
Change Log
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
An operation handler can accept user-defined data types as long as they implement
FromParts<Protocol>
. The trait has an associated typeRejection
. Whatever data type is set forRejection
must now implement (at least)std::fmt::Display
. Additionally, it is recommended to implementstd::error::Error
for that type.This requirement is necessary to help us write error log entries when the parameter that the operation handler expects fails to be
constructed from the request parts.
As an example of implementing
std::error::Error
, you can refer to theRuntimeError
enum.Beta Was this translation helpful? Give feedback.
All reactions