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
I don't really understand the logic here. You first test for `axis is not None`, which will almost always be the case (as axis has a default value of 0), and only afterwards you test if `level` and/or `by` are not None. But I think you will never get there since ``if axis is not None`` will give True?