docs: extend building a middleware from scratch guide#752
Closed
samueljoli wants to merge 1 commit intotower-rs:masterfrom
Closed
docs: extend building a middleware from scratch guide#752samueljoli wants to merge 1 commit intotower-rs:masterfrom
samueljoli wants to merge 1 commit intotower-rs:masterfrom
Conversation
add steps: create a layer, integration with service builder
GlenDC
reviewed
Dec 4, 2023
| ``` | ||
|
|
||
| That's because there's an attempt to convert a Box<dyn StdError + Send + Sync + 'static> into Infallible. The Infallible type is used to signify that a function will never return an error. | ||
| > Axum’s error handling model requires handlers to always return a response. However middleware is one possible way to introduce errors into an application. If hyper receives an error the connection will be closed without sending a response. Thus axum requires those errors to be handled gracefully. - [doc](https://docs.rs/axum/latest/axum/middleware/index.html#error-handling-for-middleware) |
Contributor
There was a problem hiding this comment.
Should we really add specific framework mentions to these fundamental docs? Is that done elsewhere? Just asking, as I'm not sure of the value of it, given not everyone might be familiar with hyper and/or axum.
Author
There was a problem hiding this comment.
@GlenDC That's a valid point. Apologies, I'm kinda new to the tokio ecosystem and didn't fully realize that tower is incredibly framework agnostic. The motivation was to provide an example of usage and what issues might come up when integrating with Axum. But you're right in that:
given not everyone might be familiar with hyper and/or axum.
Maybe this can find a home in one of Axum's examples
I can close out this PR and the accompanying Issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add steps:
addresses: #751