Commit Graph

1 Commits

Author SHA1 Message Date
Carl Lerche fb01af2ad9
filter: Update error style (#178)
This patch does not migrate tower-filter to use an error type of
Box<Error>. Instead, it defines a new type that optionally contains
a Box<Error>.

The filter layer can be used as part of routing. The router would
sequentially attempt to dispatch a request to an inner service. If
the request is rejected, it attempts the next one. In this case, allocating
a Box<Error> for each attempt is not great.

This strategy still fits within the greater picture. tower_filter::error::Error
implements the error trait, which means that all other layers that take
T: Into<Error> will still work with Filter. Also, only the immediate caller
of Filter should care about rejection errors. In which case, Filter will be
referenced explicitly.

Refs: #131
2019-03-01 15:25:21 -08:00