Hi,
i' trying to build a custom directive which completes a *Future *of *Either*.
However, the following only works if i omit the status code when completing
the *Right* case (i.e. *complete(result)* ).
def completeEither[A](successStatusCode: StatusCodes.Success, future: =>
Future[Either[RequestError, A]])(implicit m: ToResponseMarshaller[A]) =
onSuccess(future) {
case Right(result) =>
complete(successStatusCode -> result)
case Left(BadRequest(message)) =>
complete(StatusCodes.BadRequest -> message)
case Left(_) =>
complete(StatusCodes.InternalServerError)
}
The compile error i get is: *Type mismatch, expected:
ToResponseMarshallable, actual: (StatusCodes.Success, A)*
I understand what the error message means but not where it comes from.
Based on this post
<https://groups.google.com/forum/#!topic/akka-user/jUEJm6UVItk> and due to
the implicit parameter, i'd assume that it should work.
Could anyone explain what i'm doing wrong?
Thanks & regards
Constantin
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.