-
Notifications
You must be signed in to change notification settings - Fork 360
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
sourceContentFor(aSource, nullOnMissing=false)
should NEVER return NULL, but throw an exception instead
#398
Conversation
…situation also throw an exception? In the other situation, where this API might also produce a NULL return, an exception *is* thrown instead, so this looks to me like the more consistent behaviour.
…rgument/option for the `consumer.sourceContentFor()` API.
…s code to restore intended behaviour. All tests pass.
Pull Request Test Coverage Report for Build 560
💛 - Coveralls |
1 similar comment
Pull Request Test Coverage Report for Build 560
💛 - Coveralls |
simile of #391 😢 Should better check/document my merges. |
Heh. Patches are almost identical except for unit tests. Great minds think alike and all that ;) |
Nah. It's rather more embarrassing: I had merged your code in my own fork, went on debugging some other other stuff in this lib and then when that was completed successfully, I did a manual inspection diff with the mainline, producing this one as one of the important changes. While I had been agonizing over the bugs elsewhere, I had completely forgotten about this merge. Only after filing the pullreq and going through the other pending pullreqs did I notice I had picked up your code. Hence the edited-in remark above:
The only remaining worth is the extra unit tests. |
Sorry to break it to you, but this diffset has fewer tests than my issue. You’ve removed the ones in my patchset. At least if I read the changes tab properly. |
Did a double-check: yes, you are absolutely correct. 😓 Thought I had it the other way around. Killing this one, as it's a copy of #391 and y'all should ride with that one. |
BTW, @andrewnicols : thanks for pointing this out; I had it completely wrong in my mind. |
Dupe of #391 |
when
sourceContentFor(aSource, nullOnMissing=false)
shouldn't this situation (see patch/diff) also throw an exception? In the other situation, where this API might also produce a NULL return, an exception is thrown instead, so this looks to me like the more consistent behaviour.I.e. one flow path does return NULL, while the other choses NULL or exception, depending on this
nullOrMissing
parameter. Which seems odd, at least to me.