mirror of
https://github.com/tower-rs/tower.git
synced 2025-11-07 08:53:01 +00:00
Copy editing building-a-middleware-from-scratch.md (#718)
This commit is contained in:
parent
b01bb12ddd
commit
74881d5311
@ -323,7 +323,7 @@ where
|
|||||||
// long and we have to return an error.
|
// long and we have to return an error.
|
||||||
match this.sleep.poll(cx) {
|
match this.sleep.poll(cx) {
|
||||||
Poll::Ready(()) => {
|
Poll::Ready(()) => {
|
||||||
// Our time is up, but error do we return?!
|
// Our time is up, but what error do we return?!
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
Poll::Pending => {
|
Poll::Pending => {
|
||||||
@ -377,7 +377,7 @@ and can use `match` to get at the exact error, the approach has three issues:
|
|||||||
1. In practice its common to nest lots of middleware. That would make the final
|
1. In practice its common to nest lots of middleware. That would make the final
|
||||||
error enum very large. Its not unlikely to look something like
|
error enum very large. Its not unlikely to look something like
|
||||||
`BufferError<RateLimitError<TimeoutError<MyError>>>`. Pattern matching on
|
`BufferError<RateLimitError<TimeoutError<MyError>>>`. Pattern matching on
|
||||||
such a type (to for example determine if the error is retry-able) is very
|
such a type (to, for example, determine if the error is retry-able) is very
|
||||||
tedious.
|
tedious.
|
||||||
2. If we change the order our middleware are applied in we also change the final
|
2. If we change the order our middleware are applied in we also change the final
|
||||||
error type meaning we have to update our pattern matches.
|
error type meaning we have to update our pattern matches.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user