Expand description

Extension types.

Extension types are types that are stored in and extracted from both requests and responses.

There is only one generic extension type for requests, Extension.

On the other hand, the server SDK uses multiple concrete extension types for responses in order to store a variety of information, like the operation that was executed, the operation error that got returned, or the runtime error that happened, among others. The information stored in these types may be useful to tower::Layers that post-process the response: for instance, a particular metrics layer implementation might want to emit metrics about the number of times an an operation got executed.

Structs

Generic extension type stored in and extracted from request extensions.

Extension type used to store the type of user-modeled error returned by an operation handler. These are modeled errors, defined in the Smithy model.

Extension type used to store information about Smithy operations in HTTP responses. This extension type is set when it has been correctly determined that the request should be routed to a particular operation. The operation handler might not even get invoked because the request fails to deserialize into the modeled operation input.

Extension type used to store the name of the [crate::runtime_error::RuntimeError] that occurred during request handling (see [crate::runtime_error::RuntimeErrorKind::name]). These are unmodeled errors; the operation handler was not invoked.

Functions

Extract an Extension from a request. This is essentially the implementation of FromRequest for Extension, but with a protocol-agnostic rejection type. The actual code-generated implementation simply delegates to this function and converts the rejection type into a [crate::runtime_error::RuntimeError].