diff options
author | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-30 16:29:46 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-30 16:29:46 +0700 |
commit | 604fbf0a7a082bc440c0778abd6f90005b210c16 (patch) | |
tree | fd846d42448b2d3f432056898f0c3433475ea0da /src/main/scala/xyz/driver/pdsuicommon/http | |
parent | 8811d60442d060097027b33784ece9a704458e1d (diff) | |
parent | d92a2795a02b9711aa9aed92a770f85377b31460 (diff) | |
download | rest-query-604fbf0a7a082bc440c0778abd6f90005b210c16.tar.gz rest-query-604fbf0a7a082bc440c0778abd6f90005b210c16.tar.bz2 rest-query-604fbf0a7a082bc440c0778abd6f90005b210c16.zip |
Merge pull request #54 from drivergroup/PDSUI-2336v0.11.0
PDSUI-2336 Cleanup
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuicommon/http')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuicommon/http/Directives.scala | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main/scala/xyz/driver/pdsuicommon/http/Directives.scala b/src/main/scala/xyz/driver/pdsuicommon/http/Directives.scala index d7d3df5..4f5cd8a 100644 --- a/src/main/scala/xyz/driver/pdsuicommon/http/Directives.scala +++ b/src/main/scala/xyz/driver/pdsuicommon/http/Directives.scala @@ -13,9 +13,8 @@ import xyz.driver.pdsuicommon.error.ErrorsResponse.ResponseError import xyz.driver.pdsuicommon.parsers._ import xyz.driver.pdsuicommon.db.{Pagination, SearchFilterExpr, Sorting} import xyz.driver.pdsuicommon.domain._ -import xyz.driver.pdsuicommon.serialization.PlayJsonSupport._ +import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._ import xyz.driver.core.rest.auth.AuthProvider - import scala.util.control._ import scala.util._ @@ -72,7 +71,7 @@ trait Directives { def domainExceptionHandler(req: RequestId): ExceptionHandler = { def errorResponse(ex: Throwable) = - ErrorsResponse(Seq(ResponseError(None, ex.getMessage, ErrorCode.Unspecified)), req) + ErrorsResponse(Seq(ResponseError(None, ex.getMessage, 1)), req) ExceptionHandler { case ex: AuthenticationException => complete(StatusCodes.Unauthorized -> errorResponse(ex)) case ex: AuthorizationException => complete(StatusCodes.Forbidden -> errorResponse(ex)) @@ -84,9 +83,9 @@ trait Directives { def domainRejectionHandler(req: RequestId): RejectionHandler = { def wrapContent(message: String) = { - import play.api.libs.json._ - val err = ErrorsResponse(Seq(ResponseError(None, message, ErrorCode.Unspecified)), req) - val text = Json.stringify(implicitly[Writes[ErrorsResponse]].writes(err)) + import ErrorsResponse._ + val err: ErrorsResponse = ErrorsResponse(Seq(ResponseError(None, message, 1)), req) + val text = errorsResponseJsonFormat.write(err).toString() HttpEntity(ContentTypes.`application/json`, text) } DriverApp.rejectionHandler.mapRejectionResponse { |