Copy editing building-a-middleware-from-scratch.md (#718)

This commit is contained in:
Jeffrey Hutchins 2023-01-31 11:42:19 -07:00 committed by GitHub
parent b01bb12ddd
commit 74881d5311
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.