com.datastax.driver.core.exceptions.SyntaxError Java Examples

The following examples show how to use com.datastax.driver.core.exceptions.SyntaxError. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ErrorResultIntegrationTest.java    From simulacron with Apache License 2.0 5 votes vote down vote up
@Test
public void testShouldReturnSyntaxError() throws Exception {
  String message = "pc load letter";
  server.prime(when(query).then(syntaxError(message)));

  thrown.expect(SyntaxError.class);
  thrown.expectMessage(message);
  query();
}
 
Example #2
Source File: ErrorResultIntegrationTest.java    From simulacron with Apache License 2.0 5 votes vote down vote up
@Test
public void testShouldReturnSyntaxErrorOnPrepare() throws Exception {
  String message = "this syntax is no good";
  server.prime(when(query).then(syntaxError(message)).applyToPrepare());

  thrown.expect(SyntaxError.class);
  thrown.expectMessage(message);

  prepare();
}
 
Example #3
Source File: ErrorResultIntegrationTest.java    From simulacron with Apache License 2.0 5 votes vote down vote up
@Test
public void testShouldNotReturnSyntaxErrorOnPrepare() throws Exception {
  String message = "this syntax is no good";
  server.prime(when(query).then(syntaxError(message)).ignoreOnPrepare());

  // should not throw error here.
  prepare();

  thrown.expect(SyntaxError.class);
  thrown.expectMessage(message);

  prepareAndQuery();
}
 
Example #4
Source File: ErrorResultIntegrationTest.java    From simulacron with Apache License 2.0 5 votes vote down vote up
@Test
public void testShouldNotReturnSyntaxErrorOnPrepareByDefault() throws Exception {
  String message = "this syntax is no good";
  server.prime(when(query).then(syntaxError(message)));

  // should not throw error here.
  prepare();

  thrown.expect(SyntaxError.class);
  thrown.expectMessage(message);

  prepareAndQuery();
}
 
Example #5
Source File: CassandraCqlMapState.java    From storm-cassandra-cql with Apache License 2.0 5 votes vote down vote up
protected void checkCassandraException(Exception e) {
    _mexceptions.incr();
    if (e instanceof AlreadyExistsException ||
            e instanceof AuthenticationException ||
            e instanceof DriverException ||
            e instanceof DriverInternalError ||
            e instanceof InvalidConfigurationInQueryException ||
            e instanceof InvalidQueryException ||
            e instanceof InvalidTypeException ||
            e instanceof QueryExecutionException ||
            e instanceof QueryValidationException ||
            e instanceof ReadTimeoutException ||
            e instanceof SyntaxError ||
            e instanceof TraceRetrievalException ||
            e instanceof TruncateException ||
            e instanceof UnauthorizedException ||
            e instanceof UnavailableException ||
            e instanceof ReadTimeoutException ||
            e instanceof WriteTimeoutException ||
            e instanceof ReadFailureException ||
            e instanceof WriteFailureException ||
            e instanceof FunctionExecutionException) {
        throw new ReportedFailedException(e);
    } else {
        throw new RuntimeException(e);
    }
}