Fix error reporting for extends

I couldn't figure out how to properly test this (36e55af is an abortive commit trying to set something up for Mocha) so I'm not sure if this actually works, but here's my crack at trying to fix #351 @ 53da1ea.