aboutsummaryrefslogtreecommitdiff
path: root/core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskikh@driver.xyz>2018-10-17 17:02:58 +0800
committerKseniya Tomskikh <ktomskikh@driver.xyz>2018-10-17 17:02:58 +0800
commit95c3aeecd7e6ad04ce8d216c09e779f5ca38aa6a (patch)
treedfc94f20d00c84f9dde120f065bfc9298bdff0dc /core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala
parentf5d0b038457ed9d01687f0949e22e08a6b116066 (diff)
parenta43556851bf986b81351fc9f1ae5ba51bf21dc47 (diff)
downloaddriver-core-kseniya/typized-id.tar.gz
driver-core-kseniya/typized-id.tar.bz2
driver-core-kseniya/typized-id.zip
Merge branch 'master' into kseniya/typized-idkseniya/typized-id
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.scala24
1 files changed, 24 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..b43a1d3
--- /dev/null
+++ b/core-rest/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala
@@ -0,0 +1,24 @@
+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")