MCPcopy
hub / github.com/ccxt/ccxt / joinUnwrapped

Method joinUnwrapped

java/lib/src/main/java/io/github/ccxt/Helpers.java:51–68  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 15

fetchCurrenciesMethod · 0.95
fetchMarketsMethod · 0.95
fetchAccountsMethod · 0.95
fetchTradesMethod · 0.95
fetchDepositAddressesMethod · 0.95
fetchOrderBookMethod · 0.95
fetchMarginModeMethod · 0.95
fetchMarginModesMethod · 0.95
fetchTimeMethod · 0.95
fetchCrossBorrowRatesMethod · 0.95
fetchLeverageTiersMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected