diff options
Diffstat (limited to 'src/main/scala/xyz/driver')
-rw-r--r-- | src/main/scala/xyz/driver/core/rest/errors/APIError.scala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/core/rest/errors/APIError.scala b/src/main/scala/xyz/driver/core/rest/errors/APIError.scala index f2bfae1..e0400fb 100644 --- a/src/main/scala/xyz/driver/core/rest/errors/APIError.scala +++ b/src/main/scala/xyz/driver/core/rest/errors/APIError.scala @@ -14,3 +14,27 @@ final case class InvalidInputError(override val message: String = "Invalid input extends APIError { override def statusCode: StatusCode = StatusCodes.BadRequest } + +final case class InvalidActionError(override val message: String = "This action is not allowed", + override val isPatientSensitive: Boolean = false) + extends APIError { + override def statusCode: StatusCode = StatusCodes.Forbidden +} + +final case class ResourceNotFoundError(override val message: String = "Resource not found", + override val isPatientSensitive: Boolean = false) + extends APIError { + override def statusCode: StatusCode = StatusCodes.NotFound +} + +final case class ExternalServiceTimeoutError(override val message: String = "Another service took too long to respond", + override val isPatientSensitive: Boolean = false) + extends APIError { + override def statusCode: StatusCode = StatusCodes.GatewayTimeout +} + +final case class DatabaseError(override val message: String = "Database access error", + override val isPatientSensitive: Boolean = false) + extends APIError { + override def statusCode: StatusCode = StatusCodes.InternalServerError +} |