-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
58 changed files
with
2,002 additions
and
7,235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
api/** | ||
docs/** | ||
src/** | ||
gradle/** | ||
README.md | ||
|
||
.travis.yml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 0 additions & 56 deletions
56
...algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiCallback.java
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
...algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiResponse.java
This file was deleted.
Oops, something went wrong.
61 changes: 0 additions & 61 deletions
61
...earch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ProgressRequestBody.java
This file was deleted.
Oops, something went wrong.
59 changes: 0 additions & 59 deletions
59
...arch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ProgressResponseBody.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...ient-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/LaunderThrowable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.algolia.exceptions; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.ExecutionException; | ||
|
||
@SuppressWarnings("WeakerAccess") | ||
public class LaunderThrowable { | ||
|
||
/** | ||
* Performs a get() on the asynchronous method. Launders both Interrupted and Execution exception | ||
* to business exception | ||
* | ||
* @param f The CompletableFuture to block on. | ||
*/ | ||
public static <T> T await(CompletableFuture<T> f) { | ||
try { | ||
return f.get(); | ||
} catch (InterruptedException | ExecutionException e) { | ||
throw LaunderThrowable.launder(e); | ||
} | ||
} | ||
|
||
/** Launders both Interrupted and Execution exception into business exception */ | ||
public static RuntimeException launder(Throwable t) { | ||
if (t.getCause() instanceof AlgoliaApiException) { | ||
throw (AlgoliaApiException) t.getCause(); | ||
} | ||
|
||
if (t.getCause() instanceof AlgoliaRetryException) { | ||
throw (AlgoliaRetryException) t.getCause(); | ||
} | ||
|
||
if (t.getCause() instanceof AlgoliaRuntimeException) { | ||
throw (AlgoliaRuntimeException) t.getCause(); | ||
} | ||
|
||
throw new AlgoliaRuntimeException(t); | ||
} | ||
} |
Oops, something went wrong.