@seanmonstar re: warp. how would I create my own Filter that returns a future? e.g. I have an actor that processes database queries, I want to send it a message that returns a future and the future returns the query result or a database error I'd want to handle as a rejection.
You can return futures using the and_then combinator. You'll need to map your error types to a rejection. You can customize the rendering of rejections with the recover combinator.
-
-
Sounds epic, thanks. Suggestion: Instead of expecting a Rejection (or in this case a CombineRejection), accept an error type that can Into<Rejection> so that mapping is unnecessary. Rejection could use maybe a constructor for a custom status code, too.
-
The rejection system is the least designed part of warp at the moment. The constraints on it at the moment are performance (so small, not allocating) and combining rejections in case both sides of an 'or' reject.
- 4 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.