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

Reduce Exceptions in the ConditionEvaluator #48

Merged

Conversation

nnusse
Copy link

@nnusse nnusse commented Apr 19, 2024

Hello,

this PR should reduce the amount of exceptions that the ConditionEvaluator would throw, if it receives incoming null values for the evaluation.
There are some sections in the code that are not able to handle that properly. I received already the following exceptions (in the form of stack traces on the stderr) in one of my applications:

  • java.lang.IllegalStateException: Not a JSON Primitive: null
  • java.lang.UnsupportedOperationException: JsonNull

The SDK is catching all exceptions and additionally prints the stacktrace to the standard error output channel. Unfortunately this can also harm consumers of this library, because some applications might require a specific format of messages that get printed to the error or normal output channels. From my point of view i think it is really worth it to work on the issue (#23), but i think as well, that it is always good to handle errors properly.

I also adjusted the test to let them fail, if exceptions will occur that are not expected to appear under a specific test condition. I'm not really happy with the changes that i had to introduce in the tests, but i couldn't come up with a better solution, unfortunately the SDK is catching every error which makes it hard to check if a specific error occurred.

I hope that you see value in this PR.

All the best,
Norman

@vazarkevych vazarkevych changed the base branch from main to release/0.9.3 May 14, 2024 08:39
@Bohdan-Kim
Copy link
Contributor

Hello @nnusse!
There was a merge conflict with release/0.93 branch.
The test ConditionEvaluatorTest#test_evaluateCondition_testCases() is failing after resolving merge conflict.

@Bohdan-Kim
Copy link
Contributor

It looks good

@vazarkevych vazarkevych merged commit b5a2402 into growthbook:release/0.9.3 May 22, 2024
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.

None yet

3 participants