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

Log more config errors #272

Merged
merged 1 commit into from
Apr 3, 2024
Merged

Log more config errors #272

merged 1 commit into from
Apr 3, 2024

Conversation

ThatcherK
Copy link
Contributor

No description provided.

@ThatcherK ThatcherK force-pushed the feature/handle-missing-configs branch from 439ec01 to d78b1f8 Compare April 2, 2024 14:54
Copy link

sonarqubecloud bot commented Apr 2, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Comment on lines +47 to 61
if (config.dataID && !config.baseAPIUrl) {
window.console.error('Invalid chart config: baseAPIUrl is required!');

return false;
}

if (!(config.data || config.url || config.dataID)) {
window.console.error('Invalid chart config: one of data/url/dataID is required!');

return false;
}

if (!config.mapping.subCounty) {
window.console.warn('Potentially invalid chart config: mapping.subCounty may be required!');

Copy link

Choose a reason for hiding this comment

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

Maybe add these in a validation function? I see it repeated and it's rather long lines of code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are already in a function

Comment on lines 89 to +102
if (!config.mapping.subCounty) {
window.console.error('Invalid table config: mapping.subCounty is required!');
window.console.warn('Potentially invalid table config: mapping.subCounty may be required!');

return true;
}

if (config.dataID && !config.baseAPIUrl) {
window.console.error('Invalid table config: baseAPIUrl is required!');

return false;
}

if (!(config.data || config.url || config.dataID)) {
window.console.error('Invalid table config: one of data/url/dataID is required!');
Copy link

Choose a reason for hiding this comment

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

I see repetitions here, so no function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm I don't see the repeatition, the error messages are different, and the config variables checked for are also different

Copy link

Choose a reason for hiding this comment

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

Ohh, I see

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are two validation functions, one for tables and another for charts

@ThatcherK ThatcherK merged commit bcced2e into dev Apr 3, 2024
4 checks passed
@ThatcherK ThatcherK deleted the feature/handle-missing-configs branch April 3, 2024 07:18
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