Skip to content

Commit 4f0b4f3

Browse files
committed
fixed graph not-found error handling
1 parent b1f4451 commit 4f0b4f3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import java.util.concurrent.CompletableFuture;
3333
import java.util.concurrent.CompletionException;
3434

35+
import static com.arangodb.internal.ArangoErrors.ERROR_GRAPH_NOT_FOUND;
36+
3537
public class ArangoGraphAsyncImpl extends InternalArangoGraph implements ArangoGraphAsync {
3638

3739
private final ArangoDatabaseAsync db;
@@ -54,7 +56,7 @@ public CompletableFuture<Boolean> exists() {
5456
Throwable e = err instanceof CompletionException ? err.getCause() : err;
5557
if (e instanceof ArangoDBException) {
5658
ArangoDBException aEx = (ArangoDBException) e;
57-
if (ArangoErrors.ERROR_GRAPH_NOT_FOUND.equals(aEx.getErrorNum())) {
59+
if (ArangoErrors.matches(aEx, 404, ERROR_GRAPH_NOT_FOUND)) {
5860
return false;
5961
}
6062
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929

3030
import java.util.Collection;
3131

32+
import static com.arangodb.internal.ArangoErrors.ERROR_GRAPH_NOT_FOUND;
33+
import static com.arangodb.internal.ArangoErrors.matches;
34+
3235
/**
3336
* @author Mark Vollmary
3437
*/
@@ -52,7 +55,7 @@ public boolean exists() {
5255
getInfo();
5356
return true;
5457
} catch (final ArangoDBException e) {
55-
if (ArangoErrors.ERROR_GRAPH_NOT_FOUND.equals(e.getErrorNum())) {
58+
if (matches(e, 404, ERROR_GRAPH_NOT_FOUND)) {
5659
return false;
5760
}
5861
throw e;

0 commit comments

Comments
 (0)