diff options
author | zachdriver <zach@driver.xyz> | 2018-03-09 11:47:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-09 11:47:29 -0800 |
commit | 96aa1fbf7608e3b9cd1ba06c57ab1f356409733d (patch) | |
tree | ba3526cd5fff37407f60ec6c6178d519257fa584 /src/main/scala/xyz/driver/core/rest/errors | |
parent | fccdf351f8530bb30f7ec9ca61273f0be4c80221 (diff) | |
parent | 5844800b369b5c58b557310ac0a0a36c2c3ff5a4 (diff) | |
download | driver-core-96aa1fbf7608e3b9cd1ba06c57ab1f356409733d.tar.gz driver-core-96aa1fbf7608e3b9cd1ba06c57ab1f356409733d.tar.bz2 driver-core-96aa1fbf7608e3b9cd1ba06c57ab1f356409733d.zip |
Merge pull request #137 from drivergroup/zsmith/service-exception-messagev1.8.9
Fix ServiceException classes to set Exception message for stack traces
Diffstat (limited to 'src/main/scala/xyz/driver/core/rest/errors')
-rw-r--r-- | src/main/scala/xyz/driver/core/rest/errors/serviceException.scala | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala b/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala index d842c94..095936e 100644 --- a/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala +++ b/src/main/scala/xyz/driver/core/rest/errors/serviceException.scala @@ -1,22 +1,20 @@ package xyz.driver.core.rest.errors -sealed abstract class ServiceException extends Exception { - def message: String -} +sealed abstract class ServiceException(val message: String) extends Exception(message) -final case class InvalidInputException(override val message: String = "Invalid input") extends ServiceException +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 + extends ServiceException(message) -final case class ResourceNotFoundException(override val message: String = "Resource not found") extends ServiceException +final case class ResourceNotFoundException(override val message: String = "Resource not found") + extends ServiceException(message) -final case class ExternalServiceException(serviceName: String, serviceMessage: String) extends ServiceException { - override def message = s"Error while calling '$serviceName': $serviceMessage" -} +final case class ExternalServiceException(serviceName: String, serviceMessage: String) + extends ServiceException(s"Error while calling '$serviceName': $serviceMessage") -final case class ExternalServiceTimeoutException(serviceName: String) extends ServiceException { - override def message = s"$serviceName took too long to respond" -} +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 +final case class DatabaseException(override val message: String = "Database access error") + extends ServiceException(message) |