diff --git a/.circleci/config.yml b/.circleci/config.yml
index 0a586fcc..3bf15107 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -3,16 +3,11 @@ description: FaunaDB JVM Driver Tests
executors:
core:
- parameters:
- version:
- type: enum
- enum: ["nightly"]
resource_class: large
docker:
- image: openjdk:11
- - image: fauna/faunadb
+ - image: fauna/faunadb:latest
name: core
-
environment:
SBT_VERSION: 1.7.2
FAUNA_ROOT_KEY: secret
@@ -90,10 +85,9 @@ commands:
path: results/
jobs:
- core-nightly:
+ core:
executor:
name: core
- version: nightly
steps:
- build_and_test
@@ -101,5 +95,5 @@ workflows:
version: 2
build_and_test:
jobs:
- - core-nightly:
+ - core:
context: faunadb-drivers
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 7c4ef02a..0018ce4c 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,7 @@
+4.5.0
+* Emit ResourceNotAvailableException when Fauna returns a 410 status code.
+* Emit TooManyRequestsException when Fauna returns a 429 status code.
+
4.4.0
* Support for tags and traceparent headers. PR: https://github.com/fauna/faunadb-jvm/pull/362
diff --git a/README.md b/README.md
index e4b71b8b..5483f1c8 100644
--- a/README.md
+++ b/README.md
@@ -15,8 +15,8 @@ This repository contains the FaunaDB drivers for the JVM languages. Currently, J
Javadocs and Scaladocs are hosted on GitHub:
-* [faunadb-java](http://fauna.github.io/faunadb-jvm/4.4.0/faunadb-java/api/)
-* [faunadb-scala](http://fauna.github.io/faunadb-jvm/4.4.0/faunadb-scala/api/)
+* [faunadb-java](http://fauna.github.io/faunadb-jvm/4.5.0/faunadb-java/api/)
+* [faunadb-scala](http://fauna.github.io/faunadb-jvm/4.5.0/faunadb-scala/api/)
Details Documentation for each language:
@@ -54,7 +54,7 @@ Download from the Maven central repository:
com.faunadb
faunadb-java
- 4.4.0
+ 4.5.0
compile
...
@@ -207,7 +207,7 @@ List events = capturedEvents.get();
##### faunadb-scala/sbt
```scala
-libraryDependencies += ("com.faunadb" %% "faunadb-scala" % "4.4.0")
+libraryDependencies += ("com.faunadb" %% "faunadb-scala" % "4.5.0")
```
##### Basic Usage
diff --git a/faunadb-java/src/main/java/com/faunadb/client/FaunaClient.java b/faunadb-java/src/main/java/com/faunadb/client/FaunaClient.java
index 8bd323cf..ef157dc7 100644
--- a/faunadb-java/src/main/java/com/faunadb/client/FaunaClient.java
+++ b/faunadb-java/src/main/java/com/faunadb/client/FaunaClient.java
@@ -507,6 +507,10 @@ private void handleQueryErrors(int statusCode, String body) {
throw new NotFoundException(errorResponse);
case 409:
throw new TransactionContentionException(errorResponse);
+ case 410:
+ throw new ResourceNotAvailableException(errorResponse);
+ case 429:
+ throw new TooManyRequestsException(errorResponse);
case 500:
throw new InternalException(errorResponse);
case 503:
diff --git a/faunadb-java/src/main/java/com/faunadb/client/errors/ResourceNotAvailableException.java b/faunadb-java/src/main/java/com/faunadb/client/errors/ResourceNotAvailableException.java
new file mode 100644
index 00000000..b52e57f2
--- /dev/null
+++ b/faunadb-java/src/main/java/com/faunadb/client/errors/ResourceNotAvailableException.java
@@ -0,0 +1,12 @@
+package com.faunadb.client.errors;
+
+import com.faunadb.client.HttpResponses;
+
+public class ResourceNotAvailableException extends FaunaException {
+ public ResourceNotAvailableException(HttpResponses.QueryErrorResponse response) {
+ super(response);
+ }
+ public ResourceNotAvailableException(String message) {
+ super(message);
+ }
+}
diff --git a/faunadb-java/src/main/java/com/faunadb/client/errors/TooManyRequestsException.java b/faunadb-java/src/main/java/com/faunadb/client/errors/TooManyRequestsException.java
new file mode 100644
index 00000000..7b17de7c
--- /dev/null
+++ b/faunadb-java/src/main/java/com/faunadb/client/errors/TooManyRequestsException.java
@@ -0,0 +1,12 @@
+package com.faunadb.client.errors;
+
+import com.faunadb.client.HttpResponses;
+
+public class TooManyRequestsException extends FaunaException {
+ public TooManyRequestsException(HttpResponses.QueryErrorResponse response) {
+ super(response);
+ }
+ public TooManyRequestsException(String message) {
+ super(message);
+ }
+}
diff --git a/faunadb-scala/src/main/scala/faunadb/FaunaClient.scala b/faunadb-scala/src/main/scala/faunadb/FaunaClient.scala
index 4e9789de..a1c521f6 100644
--- a/faunadb-scala/src/main/scala/faunadb/FaunaClient.scala
+++ b/faunadb-scala/src/main/scala/faunadb/FaunaClient.scala
@@ -459,6 +459,8 @@ class FaunaClient private (connection: Connection) {
case 403 => parseErrorsAndFailWith(new PermissionDeniedException(_))
case 404 => parseErrorsAndFailWith(new NotFoundException(_))
case 409 => parseErrorsAndFailWith(new TransactionContentionException(_))
+ case 410 => parseErrorsAndFailWith(new ResourceNotAvailableException(_))
+ case 429 => parseErrorsAndFailWith(new TooManyRequestsException(_))
case 500 => parseErrorsAndFailWith(new InternalException(_))
case 503 => parseErrorsAndFailWith(new UnavailableException(_))
case _ => parseErrorsAndFailWith(new UnknownException(_))
diff --git a/faunadb-scala/src/main/scala/faunadb/errors/FaunaException.scala b/faunadb-scala/src/main/scala/faunadb/errors/FaunaException.scala
index 1e8d2ffe..94cc7073 100644
--- a/faunadb-scala/src/main/scala/faunadb/errors/FaunaException.scala
+++ b/faunadb-scala/src/main/scala/faunadb/errors/FaunaException.scala
@@ -41,6 +41,23 @@ case class NotFoundException(response: Option[QueryErrorResponse], message: Stri
def this(response: QueryErrorResponse) = this(Some(response), FaunaException.respToError(response.errors))
}
+/**
+ * An exception thrown if FaunaDB responds with an HTTP 429, meaning the request was throttled.
+ */
+case class TooManyRequestsException(response: Option[QueryErrorResponse], message: String) extends FaunaException(response, message) {
+ def this(message: String) = this(None, message)
+ def this(response: QueryErrorResponse) = this(Some(response), FaunaException.respToError(response.errors))
+}
+
+/**
+ * Exception thrown if FaunaDB responds with an HTTP 410.
+ * One example of this is if an account is disabled.
+ */
+case class ResourceNotAvailableException(response: Option[QueryErrorResponse], message: String) extends FaunaException(response, message) {
+ def this(message: String) = this(None, message)
+ def this(response: QueryErrorResponse) = this(Some(response), FaunaException.respToError(response.errors))
+}
+
/**
* An exception thrown if FaunaDB responds with an HTTP 500. Such errors represent an internal
* failure within the database.
diff --git a/project/Settings.scala b/project/Settings.scala
index a8577e02..11a949bf 100644
--- a/project/Settings.scala
+++ b/project/Settings.scala
@@ -6,7 +6,7 @@ import scoverage.ScoverageSbtPlugin.autoImport._
object Settings {
- lazy val driverVersion = "4.4.0"
+ lazy val driverVersion = "4.5.0"
lazy val scala211 = "2.11.12"
lazy val scala212 = "2.12.14"