-
Notifications
You must be signed in to change notification settings - Fork 109
Add error raise for deep_symbolize_keys! #346
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
Add error raise for deep_symbolize_keys! #346
Conversation
Great catch, @IvanTakarlikov-st , and thank you very much for the pull request. Even though this is the right thing to do, it still represents a breaking change. Whether it was intentional or not, I propose the following:
I can create the Jira ticket, if you'll adjust this PR to warn instead of raise. |
It makes a total sense to me, I'll adjust it to be warning. |
JIRA ticket here: https://jira.mongodb.org/browse/RUBY-3656 |
Updated the behaviour to print warn, not raising error. |
@jamis a hard error is much better than a warning here. My team was using this by accident, and I guarantee they will miss any warning line. A hard error would have saved us from a production issue. Data corruption -- which the current broken method causes, and a warning does not fix -- is far worse than just getting an error which you can see and fix. How about releasing it as BSON 5.1, as users will read the release notes. This is one of the many issues I fixed in #348. @IvanTakarlikov-st please take a look at that PR, if you're using |
@johnnyshields I agree, and said as much in my comments to Ivan. However, as I said above, raising an exception is a breaking change, and can't be introduced until BSON 6. In the meantime, an error message will have to suffice. |
OK, well, we can agree to disagree on the definition of "breaking change". In my view, you can't break something that's already broken--in fact, you do your users a service by clearly flagging it as such! |
Overview
Analogue of this PR but for `.deep_symbolize_keys!'
Inspired by few hours debugging why things behave weird
It will be also great to backport it to 4 major, I can create PR if you'll accept this one.