Actually, I think I'm satisfied with the way this is turning out. The
APIError marshaller takes care of status code and mapping to an ErrorDTO. I
ditched the PimpedResult stuff - for a successful response, I think setting
the status code here in the route is OK (so to speak). And this doesn't
precl
Yes, I just got a version that compiles, but
I'm in the airport so can't paste it here. It's really ugly and there are type
erasure warnings. Thanks for the help
Sent from my phone - will be brief
> On Oct 7, 2016, at 4:33 PM, Akka Team wrote:
>
> You can still pattern match on the type, like
You can still pattern match on the type, like so:
case result: SomeType => complete(result)
--
Johan
Akka Team
On Fri, Oct 7, 2016 at 4:30 PM, Richard Rodseth wrote:
> You're right the types are different, and PimpedResult is not a case class
> so pattern matching doesn't work out. I think
You're right the types are different, and PimpedResult is not a case class so
pattern matching doesn't work out. I think I must abandon this approach and
mimic Heiko's.
Was hoping to ease the port from Spray but
this BinTray contribution is too complex.
Sent from my phone - will be brief
> On O
To be fair you are doing something pretty complex with them, but I agree,
the magnet pattern definitely can be humbling.
Did the code that worked just fine earlier really deal with the exact same
type (tuple with statuscode and APIError)?
--
Johan
Akka Team
On Fri, Oct 7, 2016 at 1:30 PM, Richar
Heiko has a different approach here
https://github.com/hseeberger/reactive-flows/blob/master/src/main/scala/de/heikoseeberger/reactiveflows/Api.scala
onSuccess(flowFacade ? addFlow) {
case bc: BadCommand => complete(BadRequest -> bc)
case fe: FlowExists => complete(Conflict -> fe)
case fa: FlowAdd
WARNING: I may very well be incorrect here
Options:
A: switch to the onComplete directive
B: map to an Either[Result, PimpedResult]?
On Fri, Oct 7, 2016 at 6:38 PM, Richard Rodseth wrote:
> That's the trouble. Depending on whether the actor calls withStatusCode,
> it could be a Result or a Pimp
That's the trouble. Depending on whether the actor calls withStatusCode, it
could be a Result or a PimpedResult. Both can be marshalled.
In the Spray application we completed the request inside a per-request
actor. That is no longer possible, hence using Ask.
On Fri, Oct 7, 2016 at 11:18 AM, Akka
If you know the type of the expected response from the ask, then you use
`mapTo` on the returned Future to coerce it.
On Fri, Oct 7, 2016 at 5:55 PM, Richard Rodseth wrote:
> Continuing my struggles to port something we did with Spray, using
>
> // See https://bitbucket.org/binarycamp/spray-cont
Hi Richard,
You can combine ask with mapTo to cast it to the right type (or fail the
future if it does not have that type), see the docs here:
http://doc.akka.io/docs/akka/2.4/scala/futures.html#use-with-actors
--
Johan
Akka Team
On Fri, Oct 7, 2016 at 10:55 AM, Richard Rodseth wrote:
> Contin
Continuing my struggles to port something we did with Spray, using
// See https://bitbucket.org/binarycamp/spray-contrib/src
I have resolved my implicit conversion errors to the point where I can
execute the following (Result[T] is an alias for Either[APIError, T]):
val successResult: Result[N
11 matches
Mail list logo