-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
439ec01
to
d78b1f8
Compare
|
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!'); | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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!'); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh, I see
There was a problem hiding this comment.
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
No description provided.