Skip to content

Commit 70ecb6b

Browse files
committed
fixed view not-found error handling
1 parent 3d409f0 commit 70ecb6b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
import java.util.concurrent.CompletableFuture;
2828
import java.util.concurrent.CompletionException;
2929

30+
import static com.arangodb.internal.ArangoErrors.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND;
31+
import static com.arangodb.internal.ArangoErrors.matches;
32+
3033
/**
3134
* @author Mark Vollmary
3235
*/
@@ -50,7 +53,7 @@ public CompletableFuture<Boolean> exists() {
5053
Throwable e = err instanceof CompletionException ? err.getCause() : err;
5154
if (e instanceof ArangoDBException) {
5255
ArangoDBException aEx = (ArangoDBException) e;
53-
if (ArangoErrors.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.equals(aEx.getErrorNum())) {
56+
if (matches(aEx, 404, ERROR_ARANGO_DATA_SOURCE_NOT_FOUND)) {
5457
return false;
5558
}
5659
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@
2525
import com.arangodb.ArangoView;
2626
import com.arangodb.entity.ViewEntity;
2727

28+
import static com.arangodb.internal.ArangoErrors.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND;
29+
import static com.arangodb.internal.ArangoErrors.matches;
30+
2831
/**
2932
* @author Mark Vollmary
3033
*/
3134
public class ArangoViewImpl extends InternalArangoView implements ArangoView {
3235
private final ArangoDatabase db;
36+
3337
protected ArangoViewImpl(final ArangoDatabaseImpl db, final String name) {
3438
super(db, db.name(), name);
3539
this.db = db;
@@ -46,7 +50,7 @@ public boolean exists() {
4650
getInfo();
4751
return true;
4852
} catch (final ArangoDBException e) {
49-
if (ArangoErrors.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.equals(e.getErrorNum())) {
53+
if (matches(e, 404, ERROR_ARANGO_DATA_SOURCE_NOT_FOUND)) {
5054
return false;
5155
}
5256
throw e;

0 commit comments

Comments
 (0)