druidexception-trial

This commit is contained in:
Zoltan Haindrich 2023-10-05 21:18:27 +00:00
parent a708ef2c31
commit 8fa06644bc
3 changed files with 12 additions and 4 deletions

View File

@ -1104,7 +1104,7 @@ public class BaseCalciteQueryTest extends CalciteTestBase
Assert.assertEquals(expectedResults.size(), results.size()); Assert.assertEquals(expectedResults.size(), results.size());
} }
public void testQueryThrows(final String sql, Consumer<ExpectedException> expectedExceptionInitializer) public void testQueryThrows(final String sql, Consumer<ExpectedException> expectedExceptionInitializer) throws Exception
{ {
testBuilder() testBuilder()
.sql(sql) .sql(sql)

View File

@ -106,7 +106,7 @@ public class QueryTestRunner
*/ */
public interface QueryVerifyStep public interface QueryVerifyStep
{ {
void verify(); void verify() throws Exception;
} }
/** /**
@ -684,8 +684,9 @@ public class QueryTestRunner
/** /**
* All testQuery roads lead to this method. * All testQuery roads lead to this method.
* @throws Exception
*/ */
public void run() public void run() throws Exception
{ {
for (QueryRunStep runStep : runSteps) { for (QueryRunStep runStep : runSteps) {
runStep.run(); runStep.run();

View File

@ -19,6 +19,10 @@
package org.apache.druid.sql.calcite; package org.apache.druid.sql.calcite;
import org.apache.druid.error.DruidException;
import org.apache.druid.error.DruidException.Category;
import org.apache.druid.error.DruidException.Persona;
public class QueryVerification public class QueryVerification
{ {
public static QueryResultsVerifierFactory ofResults(QueryResultsVerifier verifier) public static QueryResultsVerifierFactory ofResults(QueryResultsVerifier verifier)
@ -51,7 +55,10 @@ public class QueryVerification
verifier.verifyResults(queryResults); verifier.verifyResults(queryResults);
} }
catch (Exception e) { catch (Exception e) {
throw new RuntimeException("Exception during verification!", e); throw DruidException.forPersona(Persona.DEVELOPER)
.ofCategory(Category.UNCATEGORIZED)
.build(e, "Exception during verification!");
// throw new RuntimeException("Exception during verification!", e);
} }
} }
}; };