Skip to content

Configuration file related changes#1459

Merged
kryalama merged 3 commits into
masterfrom
kryalama/configex
Jan 26, 2021
Merged

Configuration file related changes#1459
kryalama merged 3 commits into
masterfrom
kryalama/configex

Conversation

@kryalama

Copy link
Copy Markdown
Contributor

Enhancements:
Improve discoverability of configuration file syntax error
Fail on invalid config attributes instead of silently ignoring

@kryalama kryalama requested a review from trask January 25, 2021 18:19

@trask trask left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the user see a friendly message on invalid json attribute?

Comment on lines +140 to +142
} catch (URISyntaxException e) {
e.printStackTrace();
} finally {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} catch (URISyntaxException e) {
e.printStackTrace();
} finally {
} catch (Throwable e) {
e.printStackTrace();

Comment on lines +143 to +150
// If the startupLogger still have some issues being initialized, just print the error stack trace
if(startupLogger == null) {
if (isFriendlyException) {
System.err.println(message);
} else {
t.printStackTrace();
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// If the startupLogger still have some issues being initialized, just print the error stack trace
if(startupLogger == null) {
if (isFriendlyException) {
System.err.println(message);
} else {
t.printStackTrace();
}
}
if (isFriendlyException) {
System.err.println(message);
} else {
t.printStackTrace();
}

try (InputStream in = Files.newInputStream(configPath)) {
Moshi moshi = MoshiBuilderFactory.createBuilderWithAdaptor();
JsonAdapter<Configuration> jsonAdapter = moshi.adapter(Configuration.class);
JsonAdapter<Configuration> jsonAdapter = moshi.adapter(Configuration.class).failOnUnknown();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@kryalama

Copy link
Copy Markdown
Contributor Author

does the user see a friendly message on invalid json attribute?

I was thinking to handle this in a new PR. I will create a work item for this.

@kryalama kryalama requested a review from trask January 25, 2021 22:28
"selfDiagnostics": {
"level": "debug"
}
]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄 👍

@kryalama kryalama merged commit 93ee092 into master Jan 26, 2021
@trask trask deleted the kryalama/configex branch February 14, 2021 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants