Import InvalidError instead of looking at global DS

I missed this one in #1811.