aboutsummaryrefslogtreecommitdiff
path: root/core-rest
diff options
context:
space:
mode:
authorJakob Odersky <jakob@driver.xyz>2018-09-12 17:30:33 -0700
committerJakob Odersky <jakob@odersky.com>2018-10-09 16:19:39 -0700
commiteb6f97b4cac548999cbf192ee83d9ba9a253b7c8 (patch)
tree6d75a23efc841a6f51e780913387000206d1fe94 /core-rest
parent4d1197099ce4e721c18bf4cacbb2e1980e4210b5 (diff)
downloaddriver-core-eb6f97b4cac548999cbf192ee83d9ba9a253b7c8.tar.gz
driver-core-eb6f97b4cac548999cbf192ee83d9ba9a253b7c8.tar.bz2
driver-core-eb6f97b4cac548999cbf192ee83d9ba9a253b7c8.zip
Move database-related functionality to separate project
This committ includes a breaking change. The database-specific utility "Converters" trait threw an exception "DatabaseException" defined in the rest package, thus breaking the dependency graph. The solution was to move the DatabaseException class from rest to database and not inherit ServiceExceptio any more. Unfortunately, the rest classes also require the database exception in propagating errors so this funtionality has been removed. The rationale is: 1. Database exceptions are rare and result in 500 errors anyway making the status code opaque to what actual error caused it. 2. In core 2.0, an improved tracing framework will make diagnosing and following database errors easier, thereby attenuating the need to forward details on service exceptions in responses.
Diffstat (limited to 'core-rest')
-rw-r--r--core-rest/src/main/scala/xyz/driver/core/json.scala2
-rw-r--r--core-rest/src/main/scala/xyz/driver/core/rest/DriverRoute.scala3
-rw-r--r--core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala3
3 files changed, 0 insertions, 8 deletions
diff --git a/core-rest/src/main/scala/xyz/driver/core/json.scala b/core-rest/src/main/scala/xyz/driver/core/json.scala
index edc2347..40888aa 100644
--- a/core-rest/src/main/scala/xyz/driver/core/json.scala
+++ b/core-rest/src/main/scala/xyz/driver/core/json.scala
@@ -383,7 +383,6 @@ object json extends PathMatchers with Unmarshallers {
case _: ResourceNotFoundException => "ResourceNotFoundException"
case _: ExternalServiceException => "ExternalServiceException"
case _: ExternalServiceTimeoutException => "ExternalServiceTimeoutException"
- case _: DatabaseException => "DatabaseException"
} {
case "InvalidInputException" => jsonFormat(InvalidInputException, "message")
case "InvalidActionException" => jsonFormat(InvalidActionException, "message")
@@ -392,7 +391,6 @@ object json extends PathMatchers with Unmarshallers {
case "ExternalServiceException" =>
jsonFormat(ExternalServiceException, "serviceName", "serviceMessage", "serviceException")
case "ExternalServiceTimeoutException" => jsonFormat(ExternalServiceTimeoutException, "message")
- case "DatabaseException" => jsonFormat(DatabaseException, "message")
}
}
diff --git a/core-rest/src/main/scala/xyz/driver/core/rest/DriverRoute.scala b/core-rest/src/main/scala/xyz/driver/core/rest/DriverRoute.scala
index 911e306..b94f611 100644
--- a/core-rest/src/main/scala/xyz/driver/core/rest/DriverRoute.scala
+++ b/core-rest/src/main/scala/xyz/driver/core/rest/DriverRoute.scala
@@ -88,9 +88,6 @@ trait DriverRoute {
case e: ExternalServiceTimeoutException =>
log.error("Service timeout error", e)
StatusCodes.GatewayTimeout
- case e: DatabaseException =>
- log.error("Database error", e)
- StatusCodes.InternalServerError
}
{ (ctx: RequestContext) =>
diff --git a/core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala b/core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala
index f2962c9..b43a1d3 100644
--- a/core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala
+++ b/core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala
@@ -22,6 +22,3 @@ final case class ExternalServiceException(
final case class ExternalServiceTimeoutException(serviceName: String)
extends ServiceException(s"$serviceName took too long to respond")
-
-final case class DatabaseException(override val message: String = "Database access error")
- extends ServiceException(message)