Block on a CompletableFuture and rethrow any wrapped ccxt error directly. CompletableFuture.join() always wraps thrown exceptions in CompletionException, which forces callers to catch the wrapper and unwrap via .getCause() to discover what actually went wrong. For ccxt's
(CompletableFuture<Object> future)
| 49 | * and any subclass-specific fields). |
| 50 | */ |
| 51 | public static Object joinUnwrapped(CompletableFuture<Object> future) { |
| 52 | try { |
| 53 | return future.join(); |
| 54 | } catch (CompletionException ce) { |
| 55 | Throwable t = ce.getCause(); |
| 56 | // peel a transpile-bridge `new RuntimeException(_e)` wrapper that |
| 57 | // some spawn() lambdas use to bridge checked exceptions — only |
| 58 | // when it's the *raw* RuntimeException class (not a subclass). |
| 59 | while (t != null |
| 60 | && t.getClass() == RuntimeException.class |
| 61 | && t.getCause() instanceof io.github.ccxt.errors.BaseError) { |
| 62 | t = t.getCause(); |
| 63 | } |
| 64 | if (t instanceof RuntimeException re) throw re; |
| 65 | if (t instanceof Error err) throw err; |
| 66 | throw ce; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Unwrap a {@link CompletionException} (and any transpile-bridge |
no outgoing calls
no test coverage detected