browse-everything icon indicating copy to clipboard operation
browse-everything copied to clipboard

Important BrowseEverything::Driver::Base methods should raise NotImplementedError

Open atz opened this issue 9 years ago • 3 comments

BrowseEverything::Driver::Base has stub methods returning defaults. Some of those are fine, like maybe validate_config() doesn't need to be implemented in each concrete child class.

But contents() and connect() must be implemented. So it is more appropriate to raise NotImplementedError in case a call falls through to the base.

atz avatar Sep 10 '16 02:09 atz

Not sure NotImplementedError is the best choice, but an error should be raised. http://chrisstump.online/2016/03/23/stop-abusing-notimplementederror/

mjgiarlo avatar Sep 10 '16 02:09 mjgiarlo

He could be right, but why should I care? I'd say the 95% of uses that he regards as "abuse" are the actual predominant meaning of the error in reality.

atz avatar Sep 27 '16 02:09 atz

I not stuck on NotImplementedError, though. As long as we raise something, that will be enough. But I find NotImplementedError as good as anything else. Explicitly raising a NoMethodError would be factually incorrect, since the method does actually exist, but exists in the base class.

atz avatar Sep 28 '16 18:09 atz