Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty print of configuration errors #2292

Closed
rsvoboda opened this issue Apr 30, 2019 · 1 comment · Fixed by #12983
Closed

Pretty print of configuration errors #2292

rsvoboda opened this issue Apr 30, 2019 · 1 comment · Fixed by #12983
Assignees
Labels
pinned Issue will never be marked as stale
Milestone

Comments

@rsvoboda
Copy link
Member

Users can do (unintended) configuration errors and Quarkus should provide human (not only Java developer) readable message. Currently java stacktrace is provided.

I can imagine several cases

  • decimal instead of integer
  • typo in boolean
  • typo in name for enums/constants - e.g. log level

Quarkus is using MP Config via SmallRye Config code so there could be also an enhancement on that side.

Proposed format:

java -Dquarkus.log.console.darken=1.5 -jar target/validation-1.0-SNAPSHOT-runner.jar
Error: Expected an integer value for 'quarkus.log.console.darken' property.

Current state:

java -Dquarkus.log.console.darken=1.5 -jar target/validation-1.0-SNAPSHOT-runner.jar
java.lang.NumberFormatException: For input string: "1.5"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:580)
	at java.lang.Integer.parseInt(Integer.java:615)
	at io.smallrye.config.Converters.lambda$static$18960f11$1(Converters.java:75)
	at io.smallrye.config.SmallRyeConfig.convert(SmallRyeConfig.java:133)
	at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:76)
	at io.quarkus.runtime.generated.RunTimeConfig.parseKey_log_console_darken(Unknown Source)
	at io.quarkus.runtime.generated.RunTimeConfig.parseKey_log_console(Unknown Source)
	at io.quarkus.runtime.generated.RunTimeConfig.parseKey_log(Unknown Source)
	at io.quarkus.runtime.generated.RunTimeConfig.parseKey(Unknown Source)
	at io.quarkus.runtime.generated.RunTimeConfig.getRunTimeConfiguration(Unknown Source)
	at io.quarkus.runner.ApplicationImpl1.doStart(Unknown Source)
	at io.quarkus.runtime.Application.start(Application.java:101)
	at io.quarkus.runtime.Application.run(Application.java:213)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
Exception in thread "main" java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl1.doStart(Unknown Source)
	at io.quarkus.runtime.Application.start(Application.java:101)
	at io.quarkus.runtime.Application.run(Application.java:213)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
Caused by: java.lang.NumberFormatException: For input string: "1.5"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:580)
	at java.lang.Integer.parseInt(Integer.java:615)
	at io.smallrye.config.Converters.lambda$static$18960f11$1(Converters.java:75)
	at io.smallrye.config.SmallRyeConfig.convert(SmallRyeConfig.java:133)
	at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:76)
	at io.quarkus.runtime.generated.RunTimeConfig.parseKey_log_console_darken(Unknown Source)
	at io.quarkus.runtime.generated.RunTimeConfig.parseKey_log_console(Unknown Source)
	at io.quarkus.runtime.generated.RunTimeConfig.parseKey_log(Unknown Source)
	at io.quarkus.runtime.generated.RunTimeConfig.parseKey(Unknown Source)
	at io.quarkus.runtime.generated.RunTimeConfig.getRunTimeConfiguration(Unknown Source)
	... 4 more
@dmlloyd
Copy link
Member

dmlloyd commented May 17, 2019

This relates to #2490 and #2489. But it's a distinct issue because this comes down to SmallRye's implicit converters.

@gsmet gsmet added the pinned Issue will never be marked as stale label Nov 13, 2019
gastaldi added a commit to gastaldi/smallrye-config that referenced this issue Oct 21, 2020
@gastaldi gastaldi self-assigned this Oct 21, 2020
gastaldi added a commit to gastaldi/smallrye-config that referenced this issue Oct 21, 2020
radcortez pushed a commit to smallrye/smallrye-config that referenced this issue Oct 21, 2020
@gastaldi gastaldi linked a pull request Oct 27, 2020 that will close this issue
@gsmet gsmet added this to the 1.10 - master milestone Oct 27, 2020
@gsmet gsmet modified the milestones: 1.10 - master, 1.9.1.Final Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pinned Issue will never be marked as stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants