Updating generic.py error message

This is my first attempt at a PR. I just made a little change to allow an error message. Would appreciate some feedback. 
Based on https://github.com/pydata/pandas/issues/8015
You are right, this is a bit too overblown - it would be better to just add a if statement and raise errors then. Is there an error message you'd recommend? Is attribute error too much - I know there are all sorts of best practices with writing exceptions. 

I'll do something this weekend or evening and submit a little fix.