logger.error(nae.getMessage()); throw nae;
/** * Copy the exception. * * <p>This returns a new exception, equivalent to the original one, except that because a new * object is created in the current thread, the top-most element in the stacktrace of the * exception will refer to the current thread (this is mainly intended for internal use by the * driver). The cause of the copied exception will be the original exception. * * @return a copy/clone of this exception. */ public DriverException copy() { return new DriverException(getMessage(), this); } }
static RuntimeException propagateCause(ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof Error) throw ((Error) cause); // We could just rethrow e.getCause(). However, the cause of the ExecutionException has likely // been // created on the I/O thread receiving the response. Which means that the stacktrace associated // with said cause will make no mention of the current thread. This is painful for say, finding // out which execute() statement actually raised the exception. So instead, we re-create the // exception. if (cause instanceof DriverException) throw ((DriverException) cause).copy(); else throw new DriverInternalError("Unexpected exception thrown", cause); } }
public EC2MultiRegionAddressTranslator() { Hashtable<Object, Object> env = new Hashtable<Object, Object>(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory"); try { ctx = new InitialDirContext(env); } catch (NamingException e) { throw new DriverException("Could not create translator", e); } }
@Override public RetryDecision onRequestError( Statement statement, ConsistencyLevel cl, DriverException e, int nbRetry) { RetryDecision decision = policy.onRequestError(statement, cl, e, nbRetry); switch (decision.getType()) { case IGNORE: logDecision(IGNORING_REQUEST_ERROR, cl, nbRetry, e.toString()); break; case RETRY: logDecision( RETRYING_ON_REQUEST_ERROR, host(decision), cl(cl, decision), cl, nbRetry, e.toString()); break; } return decision; }
logError( connection.address, new DriverException("Got unexpected response to prepare message: " + response)); retry(false, null); logError( connection.address, new DriverException("Error preparing query, got " + response)); if (metricsEnabled()) metrics().getErrorMetrics().getOthers().inc(); retry(false, null);
String getRawMessage() { return super.getMessage(); } }
/** * Copy the exception. * <p/> * This returns a new exception, equivalent to the original one, except that * because a new object is created in the current thread, the top-most * element in the stacktrace of the exception will refer to the current * thread (this is mainly intended for internal use by the driver). The cause of * the copied exception will be the original exception. * * @return a copy/clone of this exception. */ public DriverException copy() { return new DriverException(getMessage(), this); } }
errors = logError(host, new DriverException("Connection thread interrupted"), errors, iter); while (iter.hasNext()) errors = logError( iter.next(), new DriverException("Connection thread interrupted"), errors, iter);
static RuntimeException extractCauseFromExecutionException(ExecutionException e) { // We could just rethrow e.getCause(). However, the cause of the ExecutionException has likely been // created on the I/O thread receiving the response. Which means that the stacktrace associated // with said cause will make no mention of the current thread. This is painful for say, finding // out which execute() statement actually raised the exception. So instead, we re-create the // exception. if (e.getCause() instanceof DriverException) throw ((DriverException)e.getCause()).copy(); else throw new DriverInternalError("Unexpected exception thrown", e.getCause()); } }
String getRawMessage() { return super.getMessage(); }
/** * Copy the exception. * <p/> * This returns a new exception, equivalent to the original one, except that * because a new object is created in the current thread, the top-most * element in the stacktrace of the exception will refer to the current * thread (this is mainly intended for internal use by the driver). The cause of * the copied exception will be the original exception. * * @return a copy/clone of this exception. */ public DriverException copy() { return new DriverException(getMessage(), this); } }
new DriverException( "Aborting attempt to set keyspace to '" + keyspace
static RuntimeException propagateCause(ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof Error) throw ((Error) cause); // We could just rethrow e.getCause(). However, the cause of the ExecutionException has likely been // created on the I/O thread receiving the response. Which means that the stacktrace associated // with said cause will make no mention of the current thread. This is painful for say, finding // out which execute() statement actually raised the exception. So instead, we re-create the // exception. if (cause instanceof DriverException) throw ((DriverException) cause).copy(); else throw new DriverInternalError("Unexpected exception thrown", cause); }
String getRawMessage() { return super.getMessage(); }
/** * Copy the exception. * <p/> * This returns a new exception, equivalent to the original one, except that * because a new object is created in the current thread, the top-most * element in the stacktrace of the exception will refer to the current * thread (this is mainly intended for internal use by the driver). The cause of * the copied exception will be the original exception. * * @return a copy/clone of this exception. */ public DriverException copy() { return new DriverException(getMessage(), this); } }
@Test(groups = "unit") public void should_not_log_error_if_level_higher_than_DEBUG() throws Exception { // given normal.setLevel(INFO); slow.setLevel(INFO); error.setLevel(INFO); // when queryLogger = QueryLogger.builder().build(); queryLogger.onRegister(mock(Cluster.class)); queryLogger.update(null, mock(BoundStatement.class), new DriverException("booh"), 0); // then assertThat(normalAppender.get()).isEmpty(); assertThat(slowAppender.get()).isEmpty(); assertThat(errorAppender.get()).isEmpty(); }
static RuntimeException propagateCause(ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof Error) throw ((Error) cause); // We could just rethrow e.getCause(). However, the cause of the ExecutionException has likely been // created on the I/O thread receiving the response. Which means that the stacktrace associated // with said cause will make no mention of the current thread. This is painful for say, finding // out which execute() statement actually raised the exception. So instead, we re-create the // exception. if (cause instanceof DriverException) throw ((DriverException) cause).copy(); else throw new DriverInternalError("Unexpected exception thrown", cause); } }
String getRawMessage() { return super.getMessage(); }
/** * Copy the exception. * <p> * This return a new exception, equivalent to the original one, except that * because a new object is created in the current thread, the top-most * element in the stacktrace of the exception will refer to the current * thread (this mainly use for internal use by the driver). The cause of * the copied exception will be the original exception. * * @return a copy/clone of this exception. */ public DriverException copy() { return new DriverException(getMessage(), this); } }