Skip to content

Commit 3d409f0

Browse files
committed
fixed search not-found error handling
1 parent 4f0b4f3 commit 3d409f0

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

core/src/main/java/com/arangodb/internal/ArangoGraphAsyncImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.util.concurrent.CompletionException;
3434

3535
import static com.arangodb.internal.ArangoErrors.ERROR_GRAPH_NOT_FOUND;
36+
import static com.arangodb.internal.ArangoErrors.matches;
3637

3738
public class ArangoGraphAsyncImpl extends InternalArangoGraph implements ArangoGraphAsync {
3839

@@ -56,7 +57,7 @@ public CompletableFuture<Boolean> exists() {
5657
Throwable e = err instanceof CompletionException ? err.getCause() : err;
5758
if (e instanceof ArangoDBException) {
5859
ArangoDBException aEx = (ArangoDBException) e;
59-
if (ArangoErrors.matches(aEx, 404, ERROR_GRAPH_NOT_FOUND)) {
60+
if (matches(aEx, 404, ERROR_GRAPH_NOT_FOUND)) {
6061
return false;
6162
}
6263
}

core/src/main/java/com/arangodb/internal/ArangoSearchAsyncImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
import java.util.concurrent.CompletableFuture;
3131
import java.util.concurrent.CompletionException;
3232

33+
import static com.arangodb.internal.ArangoErrors.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND;
34+
import static com.arangodb.internal.ArangoErrors.matches;
35+
3336
/**
3437
* @author Mark Vollmary
3538
*/
@@ -54,7 +57,7 @@ public CompletableFuture<Boolean> exists() {
5457
Throwable e = err instanceof CompletionException ? err.getCause() : err;
5558
if (e instanceof ArangoDBException) {
5659
ArangoDBException aEx = (ArangoDBException) e;
57-
if (ArangoErrors.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.equals(aEx.getErrorNum())) {
60+
if (matches(aEx, 404, ERROR_ARANGO_DATA_SOURCE_NOT_FOUND)) {
5861
return false;
5962
}
6063
}

core/src/main/java/com/arangodb/internal/ArangoSearchImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
import com.arangodb.model.arangosearch.ArangoSearchCreateOptions;
2929
import com.arangodb.model.arangosearch.ArangoSearchPropertiesOptions;
3030

31+
import static com.arangodb.internal.ArangoErrors.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND;
32+
import static com.arangodb.internal.ArangoErrors.matches;
33+
3134
/**
3235
* @author Mark Vollmary
3336
*/
@@ -50,7 +53,7 @@ public boolean exists() {
5053
getInfo();
5154
return true;
5255
} catch (final ArangoDBException e) {
53-
if (ArangoErrors.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.equals(e.getErrorNum())) {
56+
if (matches(e, 404, ERROR_ARANGO_DATA_SOURCE_NOT_FOUND)) {
5457
return false;
5558
}
5659
throw e;

0 commit comments

Comments
 (0)