aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/services')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/rest/RestHelper.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestHelper.scala b/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestHelper.scala
index 5284ff1..bc886ba 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestHelper.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/rest/RestHelper.scala
@@ -92,10 +92,10 @@ trait RestHelper {
def extractErrorMessage(response: HttpResponse): Future[String] = {
import xyz.driver.pdsuicommon.serialization.PlayJsonSupport._
Unmarshal(response.entity)
- .to[ErrorsResponse.ResponseError]
+ .to[ErrorsResponse]
.transform(
- _.message,
- ex => new DomainException(ex.getMessage)
+ response => response.errors.map(_.message).mkString(", "),
+ ex => new DomainException("Response has invalid format", ex)
)
}
@@ -108,7 +108,7 @@ trait RestHelper {
case StatusCodes.Forbidden => new AuthorizationException(message)
case StatusCodes.NotFound => new NotFoundException(message)
case other =>
- new DomainException(s"Unhandled domain error for HTTP status ${other.value}. Message ${message}")
+ new DomainException(s"Unhandled domain error for HTTP status ${other.value}. ${message}")
})
}
}