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

raise exception when validating datafile and datafile is not valid #376

Closed
zhammer opened this issue Jan 26, 2022 · 2 comments
Closed

raise exception when validating datafile and datafile is not valid #376

zhammer opened this issue Jan 26, 2022 · 2 comments

Comments

@zhammer
Copy link

zhammer commented Jan 26, 2022

would it be possible to send an exception to the error handler when schema validation is enabled but the datafile provided is not valid? current behavior is log error but continue as is.

if self.validate_schema:
if not validator.is_datafile_valid(datafile):
self.logger.error(enums.Errors.INVALID_INPUT.format('datafile'))
return

@Mat001
Copy link
Contributor

Mat001 commented Jan 27, 2022

Thank you @zhammer . Looking into it.
There may be considerations around consistency inside Py sdk as well with other SDKs.
Also how expensive the change would be, also seems like an be an API change.

@Mat001
Copy link
Contributor

Mat001 commented Jan 31, 2022

@zhammer My assumption is that you would like to be informed in real time if datafile validation failed?
Yes, you can set the logger to show the error, but that's not it.

You could use Decide API in the SDK to display reasons. We return null variation and error message in real-time (in reasons when config fails).
For example set options = [DecideOption.INCLUDE_REASONS] and then call reasons on your decision like so decision.reasons.
You should get the error message: 'Optimizely SDK not configured properly yet.'
Would that work?

Changing log error to raising an exception would unfortunately be a breaking change for the API which is a significant task for the moment.

@Mat001 Mat001 closed this as completed Feb 2, 2022
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

No branches or pull requests

2 participants