dubeejw commented on a change in pull request #2218: Port Controller from Spray
to Akka
URL:
https://github.com/apache/incubator-openwhisk/pull/2218#discussion_r130391406
##########
File path: common/scala/src/main/scala/whisk/http/ErrorResponse.scala
##########
@@ -168,7 +168,7 @@ case class ErrorResponse(error: String, code:
TransactionId)
/** Custom rejection, wraps status code for response and a cause. */
case class CustomRejection private (status: StatusCode, cause: String) extends
Rejection
-object ErrorResponse extends Directives {
+object ErrorResponse extends Directives with DefaultJsonProtocol {
Review comment:
Previously we marshaled the ErrorResponse case class ourselves with `
resp.withEntity(marshalling.marshalUnsafe(ErrorResponse(msg.asString,
transid)))`. This `marshalUnsafe` method no longer seems to exist in Akka. Now
I am calling `.toJson` on the `ErrorResponse`.
Ex:
```
val error = ErrorResponse(ent.data.utf8String, transid).toJson
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services