MCPcopy Index your code
hub / github.com/ccxt/ccxt / onError

Method onError

java/lib/src/main/java/io/github/ccxt/ws/WsClient.java:439–471  ·  view source on GitHub ↗
(Object err)

Source from the content-addressed store, hash-verified

437 }
438
439 void onError(Object err) {
440 if (this.verbose) {
441 System.err.println( getFormattedDate() + "WsClient error on " + this.url + ": " + err);
442 }
443 this.isConnected = false;
444 this.startedConnecting.set(false);
445 this.error = true;
446
447 Throwable t = (err instanceof Throwable th)
448 ? th
449 : new RuntimeException(String.valueOf(err));
450
451 // Wrap raw Netty / I/O / SSL exceptions in NetworkError so the test
452 // harness's isTemporaryFailure() check (instanceof OperationFailed)
453 // treats them as transient — matches Python's `NetworkError(str(e))`
454 // behaviour. Without this, a handshake 4xx or socket reset propagates
455 // out of `watch()` as the raw WebSocketHandshakeException and tests
456 // mark it as a fatal failure instead of retrying.
457 Throwable wrapped = wrapAsNetworkError(t);
458
459 // Complete-then-replace: surface the error to current awaiters and
460 // install a fresh future for the next connect() attempt.
461 synchronized (connectedLock) {
462 if (!this.connected.isDone()) {
463 this.connected.completeExceptionally(wrapped);
464 }
465 this.connected = new CompletableFuture<>();
466 }
467
468 if (this.onErrorCallback != null) {
469 this.onErrorCallback.accept(this, wrapped);
470 }
471 }
472
473 /** See onError — wraps connection-level exceptions in NetworkError. */
474 private static Throwable wrapAsNetworkError(Throwable t) {

Callers 5

createConnectionMethod · 0.95
pingLoopMethod · 0.95
channelRead0Method · 0.45
exceptionCaughtMethod · 0.45

Calls 4

getFormattedDateMethod · 0.95
wrapAsNetworkErrorMethod · 0.95
setMethod · 0.80
isDoneMethod · 0.80

Tested by 1