-
Notifications
You must be signed in to change notification settings - Fork 765
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
Bad options
keys; should we throw?
#375
Comments
We did something a little similar in Ruby where we whitelist known options so that we could warn people when they accidentally put them in the parameters hash instead of the options hash: This pattern helps insulate users from dumb mistakes that take time to debug and I like it. +1 to doing something like what you suggest. One note is that we ended up settling on a warning to stderr instead of throwing an error. This has the advantage of being backwards compatible, and also forwards compatible to a degree (if we introduced a new option, it could be used even with an older version of the library, albeit with a warning). Thoughts? |
And oops, I'm reading my inbox backwards and just saw #306 which is very similar to the stripe-ruby issue I linked. |
No worries. #306 is actually just "throw if you combine args and options", as we currently just ignore the args if you combine them - so it's a bit different. I am 100% onside with warning via console or equivalent instead of throwing. Currently thinking of implementing this using There's some extra usefulness to using |
Yep, that sounds good to me. |
Looks like this was fixed in #465. |
A question that came to mind as a result of #374, where I sent in
api_version
instead ofstripe_version
and it didn't surface until thelatest
API Version was bumped (and my set test value no longer matchedlatest
):Should we be throwing if we see something in the
options
that doesn't belong?The text was updated successfully, but these errors were encountered: