I'm struggling to convert the following response marshaller.
ToResponseMarshaller is a trait and object in Spray, and Marshaller takes
one type parameter.

I've read the docs, and am stumped. Can anyone provide further guidance?

// See https://bitbucket.org/binarycamp/spray-contrib/src


trait APIStatusMarshallers {


    implicit def errorMarshaller[T](implicit translator: ErrorTranslator[T],

                                  statusCodeMapper: ErrorToStatusCodeMapper,

                                  m: Marshaller[T]): ToResponseMarshaller[
APIError] =

    ToResponseMarshaller.fromStatusCodeAndHeadersAndT.compose {

      error => (statusCodeMapper.orElse(ErrorToStatusCodeMapper.Default)(
error), DefaultHttpHeaders.NoCacheHeaders,translator(error))

    }



    implicit def statusMarshaller[T](implicit m: Marshaller[T]):
ToResponseMarshaller[PimpedResult[(StatusCode, T)]] = {

    ToResponseMarshaller.fromStatusCodeAndHeadersAndT.compose {

      pimpedResult => pimpedResult.result match {

        case Right(response) => (response._1, DefaultHttpHeaders.
NoCacheHeaders, response._2)

        case _ => throw new RuntimeException("StatusMarshaller got invalid
PimpedResult")

      }

    }

  }

}

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to