Skip to content

Commit

Permalink
Do not rethrow SmallRye Config ConfigValidationException in Quarkus C…
Browse files Browse the repository at this point in the history
…onfigException
  • Loading branch information
radcortez committed Jun 14, 2024
1 parent 22cd416 commit cbfde5e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@

import io.quarkus.bootstrap.logging.InitialConfigurator;
import io.quarkus.bootstrap.runner.RunnerClassLoader;
import io.quarkus.runtime.configuration.ConfigUtils;
import io.quarkus.runtime.configuration.ConfigurationException;
import io.quarkus.runtime.graal.DiagnosticPrinter;
import io.quarkus.runtime.util.ExceptionUtil;
import io.quarkus.runtime.util.StringUtil;
import io.smallrye.config.ConfigValidationException;
import sun.misc.Signal;
import sun.misc.SignalHandler;

Expand Down Expand Up @@ -188,15 +188,13 @@ public static void run(Application application, Class<? extends QuarkusApplicati
}
applicationLogger.warn("You can try to kill it with 'kill -9 <pid>'.");
}
} else if (rootCause instanceof ConfigurationException) {
} else if (rootCause instanceof ConfigurationException || rootCause instanceof ConfigValidationException) {
System.err.println(rootCause.getMessage());
} else if (rootCause instanceof PreventFurtherStepsException
&& !StringUtil.isNullOrEmpty(rootCause.getMessage())) {
System.err.println(rootCause.getMessage());
} else {
// If it is not a ConfigurationException it should be safe to call ConfigProvider.getConfig here
applicationLogger.errorv(e, "Failed to start application (with profile {0})",
ConfigUtils.getProfiles());
applicationLogger.errorv(e, "Failed to start application");
ensureConsoleLogsDrained();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class PemWithoutKeyTest {
static final QuarkusUnitTest config = new QuarkusUnitTest().setArchiveProducer(
() -> ShrinkWrap.create(JavaArchive.class)
.add(new StringAsset(configuration), "application.properties"))
.assertException(t -> assertThat(t.getCause().getMessage()).contains("quarkus.tls.key-store.pem.0.key"));
.assertException(t -> assertThat(t.getMessage()).contains("quarkus.tls.key-store.pem.0.key"));

@Test
void test() throws KeyStoreException, CertificateParsingException {
Expand Down

0 comments on commit cbfde5e

Please sign in to comment.