Skip to content

Commit

Permalink
simplified ArangoCollectionAsyncImpl handleGetDocumentExceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
michele committed Aug 28, 2019
1 parent fa75f4e commit 7361ee4
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/main/java/com/arangodb/internal/ArangoCollectionAsyncImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

/**
* @author Mark Vollmary
* @author Michele Rastelli
*/
public class ArangoCollectionAsyncImpl
extends InternalArangoCollection<ArangoDBAsyncImpl, ArangoDatabaseAsyncImpl, ArangoExecutorAsync>
Expand Down Expand Up @@ -118,18 +119,8 @@ public <T> CompletableFuture<T> getDocument(

private <T> Function<Throwable, T> handleGetDocumentExceptions(Boolean isCatchException) {
return throwable -> {
ArangoDBException arangoDBException = null;

if (throwable instanceof ArangoDBException) {
arangoDBException = (ArangoDBException) throwable;
} else if (throwable instanceof CompletionException) {
CompletionException completionException = (CompletionException) throwable;
if (completionException.getCause() instanceof ArangoDBException) {
arangoDBException = (ArangoDBException) completionException.getCause();
}
}

if (arangoDBException != null) {
if (throwable instanceof CompletionException && throwable.getCause() instanceof ArangoDBException) {
ArangoDBException arangoDBException = (ArangoDBException) throwable.getCause();
if ((arangoDBException.getResponseCode() != null && (arangoDBException.getResponseCode() == 404 || arangoDBException.getResponseCode() == 304
|| arangoDBException.getResponseCode() == 412)) && isCatchException) {
return null;
Expand Down

0 comments on commit 7361ee4

Please sign in to comment.