No description
Find a file
Vincent Ambo 0ec214423e fix(handlers): Fix chained error handling in actors
This took me some time to figure out so it's useful to document in the
commit message.

When chaining messages from actors, the result type of a message (i.e.
the actual `<M as Message>::Result`) is sometimes itself a
`Result<T, E>`.

In many cases this leads to a situation where the return type of a
message sending process is something like (simplified):

    Future<Item=Result<Foo, ConverseError>, Error=actix::MailboxError>

Due to the implementation of
`From<actix::MailboxError> for ConverseError` it is possible to use
`.from_err()` on these futures to convert the future's `Error` to
`ConverseError`.

The type `Result` apparently implements `IntoFuture`, which means that
due to some trait magic that's been applied somewhere in the futures
API a call to `flatten()` can "lift" the contained error if the error
types match and give us a "simple"

    Future<Item=Foo, Error=ConverseError>

From that point on chaining becomes easy.
2018-04-12 00:04:37 +02:00
migrations feat(migrations): Add author columns to tables 2018-04-08 20:27:22 +02:00
src fix(handlers): Fix chained error handling in actors 2018-04-12 00:04:37 +02:00
templates fix(templates/handlers): Fix post anchors 2018-04-11 16:35:40 +02:00
.gitignore chore: Add bootstrapped Cargo project 2018-04-08 15:48:49 +02:00
Cargo.lock chore(cargo): Use stable release of actix-web 2018-04-11 21:21:21 +02:00
Cargo.toml chore(cargo): Use stable release of actix-web 2018-04-11 21:21:21 +02:00
todo.org refactor(handlers): Use rendering actor for page renders 2018-04-11 12:18:33 +02:00