Skip to content

Commit

Permalink
druidexception-trial
Browse files Browse the repository at this point in the history
  • Loading branch information
kgyrtkirk committed Oct 5, 2023
1 parent a708ef2 commit 8fa0664
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ public void assertResultsEquals(String sql, List<Object[]> expectedResults, List
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()
.sql(sql)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public QueryTestBuilder builder()
*/
public interface QueryVerifyStep
{
void verify();
void verify() throws Exception;
}

/**
Expand Down Expand Up @@ -684,8 +684,9 @@ public QueryTestRunner(QueryTestBuilder builder)

/**
* All testQuery roads lead to this method.
* @throws Exception
*/
public void run()
public void run() throws Exception
{
for (QueryRunStep runStep : runSteps) {
runStep.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

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 static QueryResultsVerifierFactory ofResults(QueryResultsVerifier verifier)
Expand Down Expand Up @@ -51,7 +55,10 @@ public QueryTestRunner.QueryVerifyStep make(QueryTestRunner.BaseExecuteQuery exe
verifier.verifyResults(queryResults);
}
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);
}
}
};
Expand Down

0 comments on commit 8fa0664

Please sign in to comment.