aboutsummaryrefslogtreecommitdiff
path: root/core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala
diff options
context:
space:
mode:
authorJakob Odersky <jakob@driver.xyz>2018-09-12 16:40:57 -0700
committerJakob Odersky <jakob@odersky.com>2018-10-09 16:19:39 -0700
commit4d1197099ce4e721c18bf4cacbb2e1980e4210b5 (patch)
tree1d3c2e482d5acf8ca613ba65fb5401c41ad686b5 /core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala
parent7c755c77afbd67ae2ded9d8b004736d4e27e208f (diff)
downloaddriver-core-4d1197099ce4e721c18bf4cacbb2e1980e4210b5.tar.gz
driver-core-4d1197099ce4e721c18bf4cacbb2e1980e4210b5.tar.bz2
driver-core-4d1197099ce4e721c18bf4cacbb2e1980e4210b5.zip
Move REST functionality to separate project
Diffstat (limited to 'core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala')
-rw-r--r--core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala27
1 files changed, 27 insertions, 0 deletions
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
new file mode 100644
index 0000000..f2962c9
--- /dev/null
+++ b/core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala
@@ -0,0 +1,27 @@
+package xyz.driver.core.rest.errors
+
+sealed abstract class ServiceException(val message: String) extends Exception(message)
+
+final case class InvalidInputException(override val message: String = "Invalid input") extends ServiceException(message)
+
+final case class InvalidActionException(override val message: String = "This action is not allowed")
+ extends ServiceException(message)
+
+final case class UnauthorizedException(
+ override val message: String = "The user's authentication credentials are invalid or missing")
+ extends ServiceException(message)
+
+final case class ResourceNotFoundException(override val message: String = "Resource not found")
+ extends ServiceException(message)
+
+final case class ExternalServiceException(
+ serviceName: String,
+ serviceMessage: String,
+ serviceException: Option[ServiceException])
+ extends ServiceException(s"Error while calling '$serviceName': $serviceMessage")
+
+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)